File tree Expand file tree Collapse file tree 2 files changed +29
-22
lines changed
dotnetcore/GxClasses/Helpers
dotnetframework/GxClasses/Helpers Expand file tree Collapse file tree 2 files changed +29
-22
lines changed Original file line number Diff line number Diff line change @@ -231,25 +231,21 @@ public static explicit operator String(Geospatial g)
231231 public Geospatial ( String value )
232232 {
233233 String s = value . ToString ( ) ;
234- initInstanceVars ( ) ;
235- this . FromString ( s ) ;
236- // serttype
237- this . setGXGeoType ( NTSGeographyWrapper . STGeometryType ( _innerValue ) . ToString ( ) ) ;
234+ InitGeo ( s ) ;
238235 }
236+
239237 public Geospatial ( Decimal latitude , Decimal longitude )
240- {
241- initInstanceVars ( ) ;
238+ {
242239 String wktBuffer = "POINT" ;
243240 wktBuffer += "(" + longitude . ToString ( "G17" , CultureInfo . InvariantCulture ) + " " + latitude . ToString ( "G17" , CultureInfo . InvariantCulture ) + ")" ;
244- this . FromString ( wktBuffer ) ;
241+ InitGeo ( wktBuffer ) ;
245242 }
246243
247244 public Geospatial ( Double latitude , Double longitude )
248- {
249- initInstanceVars ( ) ;
245+ {
250246 String wktBuffer = "POINT" ;
251247 wktBuffer += "(" + ( ( Double ) longitude ) . ToString ( "G17" , CultureInfo . InvariantCulture ) + " " + ( ( Double ) latitude ) . ToString ( "G17" , CultureInfo . InvariantCulture ) + ")" ;
252- this . FromString ( wktBuffer ) ;
248+ InitGeo ( wktBuffer ) ;
253249 }
254250
255251 public Geospatial ( String value , String format )
@@ -279,14 +275,20 @@ public Geospatial(object value)
279275 else
280276 {
281277 String s = value . ToString ( ) ;
282- new Geospatial ( s ) ;
278+ InitGeo ( s ) ;
283279 }
284280 }
285281
286282 public Geospatial ( )
287283 {
288284 initInstanceVars ( ) ;
289285 }
286+ void InitGeo ( string s )
287+ {
288+ initInstanceVars ( ) ;
289+ this . FromString ( s ) ;
290+ this . setGXGeoType ( NTSGeographyWrapper . STGeometryType ( _innerValue ) . ToString ( ) ) ;
291+ }
290292
291293 void initInstanceVars ( )
292294 {
Original file line number Diff line number Diff line change @@ -178,26 +178,24 @@ public static explicit operator String(Geospatial g)
178178
179179 public Geospatial ( String value )
180180 {
181- String s = value . ToString ( ) ;
182- initInstanceVars ( ) ;
183- this . FromString ( s ) ;
184- this . setGXGeoType ( SQLGeographyWrapper . STGeometryType ( _innerValue ) . ToString ( ) ) ;
181+ String s = value . ToString ( ) ;
182+ InitGeo ( s ) ;
185183 }
184+
186185 public Geospatial ( Decimal latitude , Decimal longitude )
187- {
188- initInstanceVars ( ) ;
186+ {
189187 String wktBuffer = "POINT" ;
190188 wktBuffer += "(" + longitude . ToString ( "G17" , CultureInfo . InvariantCulture ) + " " + latitude . ToString ( "G17" , CultureInfo . InvariantCulture ) + ")" ;
191- this . FromString ( wktBuffer ) ;
189+ InitGeo ( wktBuffer ) ;
190+
192191 }
193192
194193 public Geospatial ( Double latitude , Double longitude )
195194 {
196- initInstanceVars ( ) ;
197195 String wktBuffer = "POINT" ;
198196 wktBuffer += "(" + ( ( Double ) longitude ) . ToString ( "G17" , CultureInfo . InvariantCulture ) + " " + ( ( Double ) latitude ) . ToString ( "G17" , CultureInfo . InvariantCulture ) + ")" ;
199- this . FromString ( wktBuffer ) ;
200- }
197+ InitGeo ( wktBuffer ) ;
198+ }
201199
202200 public Geospatial ( String value , String format )
203201 {
@@ -224,7 +222,7 @@ public Geospatial(object value)
224222 else
225223 {
226224 String s = value . ToString ( ) ;
227- new Geospatial ( s ) ;
225+ InitGeo ( s ) ;
228226 }
229227 }
230228
@@ -233,6 +231,13 @@ public Geospatial()
233231 initInstanceVars ( ) ;
234232 }
235233
234+ void InitGeo ( string s )
235+ {
236+ initInstanceVars ( ) ;
237+ this . FromString ( s ) ;
238+ this . setGXGeoType ( SQLGeographyWrapper . STGeometryType ( _innerValue ) . ToString ( ) ) ;
239+ }
240+
236241 void initInstanceVars ( )
237242 {
238243 this . PointList = new PointT [ ] { new PointT ( ) } ;
You can’t perform that action at this time.
0 commit comments