File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -67,5 +67,35 @@ const char* QGis::qgisFeatureTypes[] =
67
67
" WKBMultiPolygon"
68
68
};
69
69
70
+
70
71
const double QGis::DEFAULT_IDENTIFY_RADIUS = 0.5 ;
71
72
73
+ // description strings for units
74
+ // Order must match enum indices
75
+ const char * QGis::qgisUnitTypes[] =
76
+ {
77
+ " meters" ,
78
+ " feet" ,
79
+ " degrees" ,
80
+ " <unknown>" ,
81
+ " degrees" ,
82
+ " degrees" ,
83
+ " degrees"
84
+ };
85
+
86
+ QGis::UnitType QGis::fromString ( QString unitTxt, QGis::UnitType defaultType )
87
+ {
88
+ for ( int i = 0 ; i < sizeof ( qgisUnitTypes ); i++ )
89
+ {
90
+ if ( unitTxt == qgisUnitTypes[ i ] )
91
+ {
92
+ return static_cast <UnitType>( i );
93
+ }
94
+ }
95
+ return defaultType;
96
+ }
97
+
98
+ QString QGis::toString ( QGis::UnitType unit )
99
+ {
100
+ return QString ( qgisUnitTypes[ static_cast <int >( unit ) ] );
101
+ }
Original file line number Diff line number Diff line change @@ -95,6 +95,9 @@ class CORE_EXPORT QGis
95
95
DegreesMinutesSeconds = 2 , // was 4
96
96
DegreesDecimalMinutes = 2 , // was 5
97
97
};
98
+ // Converters for the above type
99
+ static QString toString ( QGis::UnitType unit );
100
+ static UnitType fromString ( QString unitTxt, QGis::UnitType defaultType = UnknownUnit );
98
101
99
102
// ! User defined event types
100
103
enum UserEvent
@@ -109,6 +112,11 @@ class CORE_EXPORT QGis
109
112
};
110
113
111
114
static const double DEFAULT_IDENTIFY_RADIUS;
115
+
116
+ private:
117
+ // String representation of unit types (set in qgis.cpp)
118
+ static const char *qgisUnitTypes[];
119
+
112
120
};
113
121
114
122
// hack to workaround warnings when casting void pointers
You can’t perform that action at this time.
0 commit comments