mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Added options to graticule builder to allow you to define origin and enpoints and to set the graticule size at < 1 degree. Note that there is little error checking in there still, so putting in dodgy numbers may cause qgis to crash.
git-svn-id: http://svn.osgeo.org/qgis/trunk@2223 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
62e2c7cf1f
commit
aa5b4c530c
@ -3,6 +3,12 @@ ChangeLog,v 1.200 2004/10/21 17:27:35 mcoletti Exp
|
||||
------------------------------------------------------------------------------
|
||||
Version 0.6 'Simon' .... development version
|
||||
|
||||
2004-11-09 [timlinux] 0.5.0devel21
|
||||
** Added options to graticule builder to allow you to define origin and
|
||||
enpoints and to set the graticule size at < 1 degree. Note that there is
|
||||
little error checking in there still, so putting in dodgy numbers may cause
|
||||
qgis to crash.
|
||||
|
||||
2004-11-04 [timlinux] 0.5.0devel20
|
||||
** Added scale dependent visibility support to both raster and vector layers.
|
||||
|
||||
|
@ -26,7 +26,7 @@ dnl ---------------------------------------------------------------------------
|
||||
MAJOR_VERSION=0
|
||||
MINOR_VERSION=5
|
||||
MICRO_VERSION=0
|
||||
EXTRA_VERSION=20
|
||||
EXTRA_VERSION=21
|
||||
if test $EXTRA_VERSION -eq 0; then
|
||||
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
|
||||
else
|
||||
|
@ -4,7 +4,14 @@
|
||||
#include <iostream>
|
||||
#include <qfileinfo.h>
|
||||
#include <qstringlist.h>
|
||||
GraticuleCreator::GraticuleCreator(QString theOutputFileName, double theXIntervalDouble, double theYIntervalDouble)
|
||||
GraticuleCreator::GraticuleCreator(QString theOutputFileName,
|
||||
double theXIntervalDouble,
|
||||
double theYIntervalDouble,
|
||||
double theXOriginDouble,
|
||||
double theYOriginDouble,
|
||||
double theXEndPointDouble,
|
||||
double theYEndPointDouble
|
||||
)
|
||||
{
|
||||
std::cout << "GraticuleCreator constructor called with " << theOutputFileName
|
||||
<< " for output file and " << theXIntervalDouble << "," << theYIntervalDouble << " for x,y interval " << std::endl;
|
||||
@ -15,7 +22,14 @@ GraticuleCreator::GraticuleCreator(QString theOutputFileName, double theXInterva
|
||||
myShapeHandle = createShapeFile(theOutputFileName);
|
||||
//test the write point routine....
|
||||
//generatePoints(theInputFileName,myDbfHandle,myShapeHandle);
|
||||
generateGraticule(myDbfHandle,myShapeHandle,theXIntervalDouble,theYIntervalDouble);
|
||||
generateGraticule(myDbfHandle,
|
||||
myShapeHandle,
|
||||
theXIntervalDouble,
|
||||
theYIntervalDouble,
|
||||
theXOriginDouble,
|
||||
theYOriginDouble,
|
||||
theXEndPointDouble,
|
||||
theYEndPointDouble);
|
||||
DBFClose( myDbfHandle );
|
||||
SHPClose( myShapeHandle );
|
||||
return;
|
||||
@ -105,26 +119,33 @@ void GraticuleCreator::writeLine(SHPHandle theShapeHandle,
|
||||
}
|
||||
|
||||
//TODO: check for rediculous intervals!
|
||||
void GraticuleCreator::generateGraticule(DBFHandle theDbfHandle, SHPHandle theShapeHandle,double theXIntervalDouble,double theYIntervalDouble)
|
||||
void GraticuleCreator::generateGraticule(DBFHandle theDbfHandle,
|
||||
SHPHandle theShapeHandle,
|
||||
double theXIntervalDouble,
|
||||
double theYIntervalDouble,
|
||||
double theXOriginDouble,
|
||||
double theYOriginDouble,
|
||||
double theXEndPointDouble,
|
||||
double theYEndPointDouble)
|
||||
{
|
||||
|
||||
int myRecordInt=0;
|
||||
//create the arrays for storing the coordinates
|
||||
double * myXArrayDouble;
|
||||
double * myYArrayDouble;
|
||||
myXArrayDouble = (double *)malloc(2 * sizeof(double));
|
||||
myXArrayDouble = (double *)malloc(2 * sizeof(double)); //2=no vertices
|
||||
myYArrayDouble = (double *)malloc(2 * sizeof(double));
|
||||
|
||||
//
|
||||
//Longitude loop
|
||||
//
|
||||
for (double myXDouble=-180.0;myXDouble <=180.0;myXDouble+=theXIntervalDouble)
|
||||
for (double myXDouble = theXOriginDouble;myXDouble <=theXEndPointDouble;myXDouble+=theXIntervalDouble)
|
||||
{
|
||||
|
||||
myXArrayDouble[0]=myXDouble;
|
||||
myXArrayDouble[1]=myXDouble;
|
||||
myYArrayDouble[0]=-90.0;
|
||||
myYArrayDouble[1]=90.0;
|
||||
myYArrayDouble[0]=theYOriginDouble;
|
||||
myYArrayDouble[1]=theYEndPointDouble;
|
||||
|
||||
writeDbfRecord(theDbfHandle,myRecordInt,"testing");
|
||||
writeLine(theShapeHandle, myRecordInt, 2, myXArrayDouble, myYArrayDouble); //2=no vertices
|
||||
@ -135,11 +156,11 @@ void GraticuleCreator::generateGraticule(DBFHandle theDbfHandle, SHPHandle theSh
|
||||
//
|
||||
//Latitude loop
|
||||
//
|
||||
for (double myYDouble=-90.0;myYDouble<=90.0;myYDouble+=theYIntervalDouble)
|
||||
for (double myYDouble=theYOriginDouble;myYDouble<=theYEndPointDouble;myYDouble+=theYIntervalDouble)
|
||||
{
|
||||
|
||||
myXArrayDouble[0]=-180.0;
|
||||
myXArrayDouble[1]=180.0;
|
||||
myXArrayDouble[0]=theXOriginDouble;
|
||||
myXArrayDouble[1]=theXEndPointDouble;
|
||||
myYArrayDouble[0]=myYDouble;
|
||||
myYArrayDouble[1]=myYDouble;
|
||||
|
||||
|
@ -11,7 +11,13 @@
|
||||
class GraticuleCreator
|
||||
{
|
||||
public:
|
||||
GraticuleCreator(QString theOutputFileName, double theXIntervalDouble, double theYIntervalDouble);
|
||||
GraticuleCreator(QString theOutputFileName,
|
||||
double theXIntervalDouble,
|
||||
double theYIntervalDouble,
|
||||
double theXOriginDouble,
|
||||
double theYOriginDouble,
|
||||
double theXEndPointDouble,
|
||||
double theYEndPointDouble);
|
||||
~GraticuleCreator() {};
|
||||
DBFHandle GraticuleCreator::createDbf (QString theDbfName ) ;
|
||||
SHPHandle GraticuleCreator::createShapeFile(QString theFileName );
|
||||
@ -22,7 +28,14 @@ class GraticuleCreator
|
||||
int theCoordinateCountInt,
|
||||
double * theXArrayDouble,
|
||||
double * theYArrayDouble );
|
||||
void generateGraticule(DBFHandle theDbfHandle, SHPHandle theShapeHandle,double theXIntervalDouble,double theYIntervalDouble);
|
||||
void generateGraticule(DBFHandle theDbfHandle,
|
||||
SHPHandle theShapeHandle,
|
||||
double theXIntervalDouble,
|
||||
double theYIntervalDouble,
|
||||
double theXOriginDouble,
|
||||
double theYOriginDouble,
|
||||
double theXEndPointDouble,
|
||||
double theYEndPointDouble);
|
||||
void generatePoints (QString theInputFileName, DBFHandle theDbfHandle, SHPHandle theShapeHandle);
|
||||
|
||||
private:
|
||||
|
@ -14,7 +14,6 @@
|
||||
//qt includes
|
||||
#include <qpushbutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qfile.h>
|
||||
@ -39,7 +38,25 @@ void PluginGui::pbnOK_clicked()
|
||||
{
|
||||
//check input file exists
|
||||
//
|
||||
GraticuleCreator * myGraticuleCreator = new GraticuleCreator(leOutputShapeFile->text(),spinLongInterval->value(),spinLatInterval->value());
|
||||
std::cout << "GrativuleCreator called with: " <<
|
||||
leOutputShapeFile->text() <<
|
||||
leLongitudeInterval->text() <<
|
||||
leLatitudeInterval->text() <<
|
||||
leOriginLongitude->text() <<
|
||||
leOriginLatitude->text() <<
|
||||
leEndPointLongitude->text() <<
|
||||
leEndPointLatitude->text()
|
||||
<< std::endl;
|
||||
|
||||
GraticuleCreator * myGraticuleCreator = new GraticuleCreator(
|
||||
leOutputShapeFile->text(),
|
||||
leLongitudeInterval->text().toDouble(),
|
||||
leLatitudeInterval->text().toDouble(),
|
||||
leOriginLongitude->text().toDouble(),
|
||||
leOriginLatitude->text().toDouble(),
|
||||
leEndPointLongitude->text().toDouble(),
|
||||
leEndPointLatitude->text().toDouble()
|
||||
);
|
||||
//
|
||||
// If you have a produced a raster layer using your plugin, you can ask qgis to
|
||||
// add it to the view using:
|
||||
|
@ -8,8 +8,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>571</width>
|
||||
<height>393</height>
|
||||
<width>647</width>
|
||||
<height>497</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="paletteBackgroundColor">
|
||||
@ -29,7 +29,7 @@
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<widget class="QLabel" row="0" column="0" rowspan="6" colspan="1">
|
||||
<property name="name">
|
||||
<cstring>pixmapLabel1</cstring>
|
||||
</property>
|
||||
@ -40,21 +40,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>line1</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>VLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="3">
|
||||
<widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>layout108</cstring>
|
||||
</property>
|
||||
@ -106,66 +92,145 @@
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget" row="0" column="2">
|
||||
<widget class="QLabel" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>layout109</cstring>
|
||||
<cstring>txtHeading</cstring>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>24</pointsize>
|
||||
<bold>1</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Graticule Builder</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" row="0" column="1" rowspan="6" colspan="1">
|
||||
<property name="name">
|
||||
<cstring>line1</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>VLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>teInstructions</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style="font-size:11pt;font-family:Arial">
|
||||
<p style="margin-top:16px"><span style="font-size:16pt;font-weight:600">Description</span></p>
|
||||
<p>This plugin will help you to build a graticule shapefile that you can use as an overlay within your qgis map viewer.</p>
|
||||
</body></html>
|
||||
</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<enum>WidgetWidth</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="2" column="2">
|
||||
<property name="name">
|
||||
<cstring>groupBox1</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Origin (Lower Left)</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QTextEdit" row="1" column="0" rowspan="1" colspan="4">
|
||||
<widget class="QLineEdit" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>teInstructions</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style="font-size:11pt;font-family:Arial">
|
||||
<p style="margin-top:16px"><span style="font-size:16pt;font-weight:600">Description</span></p>
|
||||
<p>This plugin will help you to build a graticule shapefile that you can use as an overlay within your qgis map viewer.</p>
|
||||
</body></html>
|
||||
</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<enum>WidgetWidth</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<cstring>leOriginLatitude</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="4">
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>txtHeading</cstring>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>24</pointsize>
|
||||
<bold>1</bold>
|
||||
</font>
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Graticule Builder</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignCenter</set>
|
||||
<string>Latitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="0">
|
||||
<widget class="QLineEdit" row="0" column="3">
|
||||
<property name="name">
|
||||
<cstring>lblMinTimeGap</cstring>
|
||||
<cstring>leOriginLongitude</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Latitude Interval:</string>
|
||||
<string>Longitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0" rowspan="1" colspan="3">
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="3" column="2">
|
||||
<property name="name">
|
||||
<cstring>groupBox1_2</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>End point (Upper Right)</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLineEdit" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>lblOutputFile</cstring>
|
||||
<cstring>leEndPointLatitude</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Output (Shape) File:</string>
|
||||
<string>Latitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="3" column="3">
|
||||
<widget class="QLineEdit" row="0" column="3">
|
||||
<property name="name">
|
||||
<cstring>leEndPointLongitude</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Longitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="5" column="2">
|
||||
<property name="name">
|
||||
<cstring>groupBox3</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Output (Shape) File</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QPushButton" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>pbnSelectOutputFile</cstring>
|
||||
</property>
|
||||
@ -173,21 +238,33 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" row="4" column="3">
|
||||
<widget class="QLineEdit" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>spinLongInterval</cstring>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="lineStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
<cstring>leOutputShapeFile</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="2">
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="4" column="2">
|
||||
<property name="name">
|
||||
<cstring>groupBox4</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Graticule Size (units in degrees)</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>lblMinTimeGap</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Latitude Interval:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>lblMinDistanceGap</cstring>
|
||||
</property>
|
||||
@ -195,23 +272,14 @@
|
||||
<string>Longitude Interval:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="3" column="0" rowspan="1" colspan="3">
|
||||
<widget class="QLineEdit" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>leOutputShapeFile</cstring>
|
||||
<cstring>leLatitudeInterval</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" row="4" column="1">
|
||||
<widget class="QLineEdit" row="0" column="3">
|
||||
<property name="name">
|
||||
<cstring>spinLatInterval</cstring>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="lineStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
<cstring>leLongitudeInterval</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
@ -233,12 +301,6 @@
|
||||
<receiver>PluginGuiBase</receiver>
|
||||
<slot>pbnOK_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pbnSelectOutputFile</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PluginGuiBase</receiver>
|
||||
<slot>pbnSelectOutputFile_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pbnCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
@ -246,10 +308,10 @@
|
||||
<slot>pbnCancel_clicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>leOutputShapeFile</sender>
|
||||
<signal>textChanged(const QString&)</signal>
|
||||
<sender>pbnSelectOutputFile</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PluginGuiBase</receiver>
|
||||
<slot>leOutputShapeFile_textChanged(const QString&)</slot>
|
||||
<slot>pbnSelectOutputFile_clicked()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
|
Loading…
x
Reference in New Issue
Block a user