Skip to content
Permalink
Browse files

Merge remote branch 'pb/master'

  • Loading branch information
Sergey Yakushevs
Sergey Yakushevs committed May 19, 2011
2 parents 626c8dd + 0390131 commit 1d3ac808bbbadce2bc417f8525738e4a4449e2bd
@@ -30,3 +30,7 @@ ms-windows/untgz/
scripts/astyle.exe
# vim temporary files
.*.swp
*.aux
*.out
*.tex
*.toc
@@ -46,6 +46,14 @@ MACRO(ADD_TXT2TAGS_FILES _sources)
COMMENT "Building ${_out}.html from ${_in}"
)

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}.tex
COMMAND ${TXT2TAGS_EXECUTABLE}
ARGS -o${_out}.tex -t tex ${_in}
DEPENDS ${_in}
COMMENT "Building ${_out}.tex from ${_in}"
)

SET(${_sources} ${${_sources}} ${_out} ${_out}.html)
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_TXT2TAGS_FILES)
@@ -12,11 +12,37 @@ Developers guide for QGIS
%! PostProc(txt): '(?i)(\t)' ' '
%! encoding: iso-8859-1

%
% Tex processing
%
% Make sure this is first
%! PostProc(tex): '\\includegraphics' '\\includegraphics[width=100mm]'
% scartcl is from the koma script document class (apt-get install texlive-latex-recommended ttf-komatuna)
% setlength parindent suppresses first line of paragraph idents
% parskip puts blank space between paragraphs
% title pic stuff used to put a logo on the front page
%! PostProc(tex): '\\documentclass{article}' '\\documentclass{scrartcl}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{2ex}'
% use the color table and table packages so we can pimp the tables a little
%! PostProc(tex): '\\usepackage{style.css} % user defined' '\\usepackage{fancyvrb}\n\\usepackage{colortbl} \n\\usepackage [table]{xcolor}\n\\definecolor{tableShade}{HTML}{cecece}\n\\definecolor{qgis-green}{HTML}{0E7300}\n\\usepackage{wallpaper}\n\\LRCornerWallPaper{1}{WALLPAPER-IMAGE}\n\\usepackage{hyperref}\n\\hypersetup{linkcolor=qgis-green,urlcolor=qgis-green}\\renewcommand\\thesection{\\color{qgis-green}\\thechapter\\arabic{section}}'
% Make the header row of tables have a dark background. light text
%! PostProc(tex): '\\hline \\textbf' '\\hline \\rowcolor[rgb]{0,0,0} \\color{white} \\textbf'
%! PostProc(tex): '& \\textbf' '& \\color{white} \\textbf'
% Make verbatim text a little smaller and use fancyvrb package to draw it in a box
% Note Verbatim with capital V for fancyvrb to work
%! PostProc(tex): '\\begin{verbatim}' '{\\scriptsize\\begin{Verbatim}[frame=single,rulecolor=\\color{qgis-green}, framesep=4mm, label=\\fbox{\\small\\emph{Listing}}]'
%! PostProc(tex): '\\end{verbatim}' '\\end{Verbatim}\n}'
%! PostProc(tex): '\\section' '\\newpage\\section'
%! PostProc(tex): 'section{' 'section{\\color{qgis-green}'
%! PostProc(tex): NEWPAGE '\\newpage'
% Give alternating table rows different colours and use a smaller font in tables (\tiny)
%! PostProc(tex): '\\begin{tabular}' '\\rowcolors{2}{tableShade}{white} \n\\tiny\\begin{tabular}'
%! encoding: iso-8859-1

%! PostProc(tex): WALLPAPER-IMAGE 'qgis-footer.png'
% These are comments and will not be generated in any output
% -------------------

%This document is in text2tags format. You can generate html, plain text and
%This document is in txt2tags format. You can generate html, plain text and
%moinmoin formatted documentation by running txt2tags on this document. See the
%txt2tags home page for more details. Please insert manual line breaks in this
%document as it makes diffing for changes much easier. To do this in vim
@@ -26,12 +52,13 @@ Developers guide for QGIS

% To generate the text version of this document:
% txt2tags -t txt -o CODING CODING.t2t
% To generate the moinmoin version of this document:
% txt2tags -t moin -o CODING.moin CODING.t2t
% To generate the mediawiki version of this document:
% txt2tags -t wiki --no-enum-title -o CODING.wiki CODING.t2t
% To generate the html version of this document:
% txt2tags -t html -o CODING.html CODING.t2t
% To generate the LaTeX version of this document:
% txt2tags -t tex -o CODING.tex CODING.t2t
% txt2tags -t tex -o CODING.tex CODING.t2t; pdflatex CODING.tex

%
% End of comments
% -------------------
@@ -1,7 +1,6 @@
Quantum GIS (QGIS)

Building QGIS from source - step by step

%%date(%A %B %d, %Y)

%! target : html
%! style : style.css
@@ -12,6 +11,33 @@ Building QGIS from source - step by step
% Next line will replace tabs with 2 spaces in txt generated outputs
%! PostProc(txt): '(?i)(\t)' ' '
%! encoding: iso-8859-1
%
% Tex processing
%
% Make sure this is first
%! PostProc(tex): '\\includegraphics' '\\includegraphics[width=100mm]'
% scartcl is from the koma script document class (apt-get install texlive-latex-recommended ttf-komatuna)
% setlength parindent suppresses first line of paragraph idents
% parskip puts blank space between paragraphs
% title pic stuff used to put a logo on the front page
%! PostProc(tex): '\\documentclass{article}' '\\documentclass{scrartcl}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{2ex}'
% use the color table and table packages so we can pimp the tables a little
%! PostProc(tex): '\\usepackage{style.css} % user defined' '\\usepackage{fancyvrb}\n\\usepackage{colortbl} \n\\usepackage [table]{xcolor}\n\\definecolor{tableShade}{HTML}{cecece}\n\\definecolor{qgis-green}{HTML}{0E7300}\n\\usepackage{wallpaper}\n\\LRCornerWallPaper{1}{WALLPAPER-IMAGE}\n\\usepackage{hyperref}\n\\hypersetup{linkcolor=qgis-green,urlcolor=qgis-green}\\renewcommand\\thesection{\\color{qgis-green}\\thechapter\\arabic{section}}'
% Make the header row of tables have a dark background. light text
%! PostProc(tex): '\\hline \\textbf' '\\hline \\rowcolor[rgb]{0,0,0} \\color{white} \\textbf'
%! PostProc(tex): '& \\textbf' '& \\color{white} \\textbf'
% Make verbatim text a little smaller and use fancyvrb package to draw it in a box
% Note Verbatim with capital V for fancyvrb to work
%! PostProc(tex): '\\begin{verbatim}' '{\\scriptsize\\begin{Verbatim}[frame=single,rulecolor=\\color{qgis-green}, framesep=4mm, label=\\fbox{\\small\\emph{Listing}}]'
%! PostProc(tex): '\\end{verbatim}' '\\end{Verbatim}\n}'
%! PostProc(tex): '\\section' '\\newpage\\section'
%! PostProc(tex): 'section{' 'section{\\color{qgis-green}'
%! PostProc(tex): NEWPAGE '\\newpage'
% Give alternating table rows different colours and use a smaller font in tables (\tiny)
%! PostProc(tex): '\\begin{tabular}' '\\rowcolors{2}{tableShade}{white} \n\\tiny\\begin{tabular}'
%! encoding: iso-8859-1

%! PostProc(tex): WALLPAPER-IMAGE 'qgis-footer.png'
% These are comments and will not be generated in any output
% -------------------

@@ -30,13 +56,13 @@ Building QGIS from source - step by step
% To generate the html version of this document:
% txt2tags -t html -o INSTALL.html INSTALL.t2t
% To generate the LaTeX version of this document:
% txt2tags -t tex -o INSTALL.tex INSTALL.t2t
% txt2tags -t tex -o INSTALL.tex INSTALL.t2t; pdflatex INSTALL.tex

% End of comments
% -------------------

Last update: %%date
Last change: %%mtime
Last Updated: %%date(%A %B %d, %Y)
Last Change : %%mtime(%A %B %d, %Y)

%%toc

@@ -26,3 +26,6 @@ The following people have contributed to this document:
- GNU/Linux Section
- Tim Sutton 2006
- Debian package section: Juergen Fischer 2008

- Latex Generator
- Tim Sutton 2011
BIN +109 KB doc/qgis-footer.png
Binary file not shown.
BIN +308 KB doc/qgis-footer.xcf
Binary file not shown.
@@ -253,6 +253,9 @@ class QgsComposerItem: QObject, QGraphicsRectItem

double rotation() const;

/**Updates item, with the possibility to do custom update for subclasses*/
virtual void updateItem();

public slots:
virtual void setRotation( double r);

@@ -94,7 +94,7 @@ class QgsComposerMap : QgsComposerItem
/**Sets new Extent and changes width, height (and implicitely also scale)*/
void setNewExtent( const QgsRectangle& extent );

PreviewMode previewMode();
PreviewMode previewMode() const;
void setPreviewMode( PreviewMode m );

/**Getter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas
@@ -222,6 +222,10 @@ class QgsComposerMap : QgsComposerItem
void setCrossLength(double l);
double crossLength();

void setMapRotation( double r );

void updateItem();

public slots:

/**Called if map canvas has changed*/
@@ -58,8 +58,8 @@ def outFile( self ):
self.leOutShape.setText( self.outFileName )

def inputFile( self ):
files = QFileDialog.getOpenFileNames( self, self.tr( "Select files to merge" ), ".", "Shapefiles(*.shp *.SHP)" )
if files.isEmpty():
( files, self.inEncoding ) = ftools_utils.openDialog( self, dialogMode="ManyFiles" )
if files is None or self.inEncoding is None:
self.inputFiles = None
return

@@ -134,7 +134,7 @@ def accept( self ):
self.btnOk.setEnabled( False )

self.mergeThread = ShapeMergeThread( baseDir, self.inputFiles, self.inEncoding, self.outFileName, self.encoding )
QObject.connect( self.mergeThread, SIGNAL( "rangeChanged( PyQt_PyObject )" ), self.setProgressRange )
QObject.connect( self.mergeThread, SIGNAL( "rangeChanged( PyQt_PyObject )" ), self.setFeatureProgressRange )
QObject.connect( self.mergeThread, SIGNAL( "checkStarted()" ), self.setFeatureProgressFormat )
QObject.connect( self.mergeThread, SIGNAL( "checkFinished()" ), self.resetFeatureProgressFormat )
QObject.connect( self.mergeThread, SIGNAL( "fileNameChanged( PyQt_PyObject )" ), self.setShapeProgressFormat )
@@ -149,8 +149,8 @@ def accept( self ):

self.mergeThread.start()

def setProgressRange( self, max ):
self.progressFeatures.setRange( 0, max )
def setFeatureProgressRange( self, maximum ):
self.progressFeatures.setRange( 0, maximum )
self.progressFeatures.setValue( 0 )

def setFeatureProgressFormat( self ):
@@ -216,13 +216,38 @@ def run( self ):

interrupted = False

# create attribute list with uniquie fields
# from all selected layers
mergedFields = {}
count = 0
self.emit( SIGNAL( "rangeChanged( PyQt_PyObject )" ), len( self.shapes ) )
self.emit( SIGNAL( "checkStarted()" ) )
for fileName in self.shapes:
layerPath = QFileInfo( self.baseDir + "/" + fileName ).absoluteFilePath()
newLayer = QgsVectorLayer( layerPath, QFileInfo( layerPath ).baseName(), "ogr" )
if not newLayer.isValid():
continue
vprovider = newLayer.dataProvider()
layerFields = vprovider.fields()
for layerIndex, layerField in layerFields.iteritems():
fieldFound = False
for mergedIndex, mergedField in mergedFields.iteritems():
if ( mergedField.name() == layerField.name() ) and ( mergedField.type() == layerField.type() ):
fieldFound = True

if not fieldFound:
mergedFields[ count ] = layerField
count += 1
self.emit( SIGNAL( "featureProcessed()" ) )
self.emit( SIGNAL( "checkFinished()" ) )

# get information about shapefiles
layerPath = QFileInfo( self.baseDir + "/" + self.shapes[ 0 ] ).absoluteFilePath()
newLayer = QgsVectorLayer( layerPath, QFileInfo( layerPath ).baseName(), "ogr" )
self.crs = newLayer.crs()
self.geom = newLayer.wkbType()
vprovider = newLayer.dataProvider()
self.fields = vprovider.fields()
self.fields = mergedFields

writer = QgsVectorFileWriter( self.outputFileName, self.outputEncoding,
self.fields, self.geom, self.crs )
@@ -234,6 +259,7 @@ def run( self ):
continue
vprovider = newLayer.dataProvider()
vprovider.setEncoding( self.inputEncoding )
layerFields = vprovider.fields()
allAttrs = vprovider.attributeIndexes()
vprovider.select( allAttrs )
nFeat = vprovider.featureCount()
@@ -244,9 +270,15 @@ def run( self ):
inGeom = QgsGeometry()
while vprovider.nextFeature( inFeat ):
atMap = inFeat.attributeMap()
mergedAttrs = {}
# fill available attributes with values
for layerIndex, layerField in layerFields.iteritems():
for mergedIndex, mergedField in self.fields.iteritems():
if ( mergedField.name() == layerField.name() ) and ( mergedField.type() == layerField.type() ):
mergedAttrs[ mergedIndex ] = atMap[ layerIndex ]
inGeom = QgsGeometry( inFeat.geometry() )
outFeat.setGeometry( inGeom )
outFeat.setAttributeMap( atMap )
outFeat.setAttributeMap( mergedAttrs )
writer.addFeature( outFeat )
self.emit( SIGNAL( "featureProcessed()" ) )

@@ -253,7 +253,7 @@ def getUniqueValues( provider, index ):
return values

# Generate a save file dialog with a dropdown box for choosing encoding style
def saveDialog( parent, filtering="Shapefiles (*.shp)"):
def saveDialog( parent, filtering="Shapefiles (*.shp *.SHP)"):
settings = QSettings()
dirName = settings.value( "/UI/lastShapefileDir" ).toString()
encode = settings.value( "/UI/encoding" ).toString()
@@ -269,18 +269,24 @@ def saveDialog( parent, filtering="Shapefiles (*.shp)"):
return ( unicode( files.first() ), unicode( fileDialog.encoding() ) )

# Generate a save file dialog with a dropdown box for choosing encoding style
def openDialog( parent, filtering="Shapefiles (*.shp)"):
# with mode="SingleFile" will allow to select only one file, in other cases - several files
def openDialog( parent, filtering="Shapefiles (*.shp *.SHP)", dialogMode="SingleFile"):
settings = QSettings()
dirName = settings.value( "/UI/lastShapefileDir" ).toString()
encode = settings.value( "/UI/encoding" ).toString()
fileDialog = QgsEncodingFileDialog( parent, "Save output shapefile", dirName, QString(filtering), encode )
fileDialog.setFileMode( QFileDialog.AnyFile )
#fileDialog.setFileMode( QFileDialog.AnyFile )
fileDialog.setFileMode( QFileDialog.ExistingFiles )
fileDialog.setAcceptMode( QFileDialog.AcceptOpen )
if not fileDialog.exec_() == QDialog.Accepted:
return None, None
files = fileDialog.selectedFiles()
settings.setValue("/UI/lastShapefileDir", QVariant( QFileInfo( unicode( files.first() ) ).absolutePath() ) )
return ( unicode( files.first() ), unicode( fileDialog.encoding() ) )
#return ( unicode( files.first() ), unicode( fileDialog.encoding() ) )
if dialogMode == "SingleFile":
return ( unicode( files.first() ), unicode( fileDialog.encoding() ) )
else:
return ( files, unicode( fileDialog.encoding() ) )

# Generate a select directory dialog with a dropdown box for choosing encoding style
def dirDialog( parent ):

0 comments on commit 1d3ac80

Please sign in to comment.
You can’t perform that action at this time.