@@ -178,34 +178,66 @@ -(instancetype) initWithGeometryEnvelope: (SFGeometryEnvelope *) geometryEnvelop
178
178
return self;
179
179
}
180
180
181
+ -(double ) minXValue {
182
+ return [_minX doubleValue ];
183
+ }
184
+
181
185
-(void ) setMinXValue : (double ) x {
182
186
[self setMinX: [[NSDecimalNumber alloc ] initWithDouble: x]];
183
187
}
184
188
189
+ -(double ) maxXValue {
190
+ return [_maxX doubleValue ];
191
+ }
192
+
185
193
-(void ) setMaxXValue : (double ) x {
186
194
[self setMaxX: [[NSDecimalNumber alloc ] initWithDouble: x]];
187
195
}
188
196
197
+ -(double ) minYValue {
198
+ return [_minY doubleValue ];
199
+ }
200
+
189
201
-(void ) setMinYValue : (double ) y {
190
202
[self setMinY: [[NSDecimalNumber alloc ] initWithDouble: y]];
191
203
}
192
204
205
+ -(double ) maxYValue {
206
+ return [_maxY doubleValue ];
207
+ }
208
+
193
209
-(void ) setMaxYValue : (double ) y {
194
210
[self setMaxY: [[NSDecimalNumber alloc ] initWithDouble: y]];
195
211
}
196
212
213
+ -(double ) minZValue {
214
+ return [_minZ doubleValue ];
215
+ }
216
+
197
217
-(void ) setMinZValue : (double ) z {
198
218
[self setMinZ: [[NSDecimalNumber alloc ] initWithDouble: z]];
199
219
}
200
220
221
+ -(double ) maxZValue {
222
+ return [_maxZ doubleValue ];
223
+ }
224
+
201
225
-(void ) setMaxZValue : (double ) z {
202
226
[self setMaxZ: [[NSDecimalNumber alloc ] initWithDouble: z]];
203
227
}
204
228
229
+ -(double ) minMValue {
230
+ return [_minM doubleValue ];
231
+ }
232
+
205
233
-(void ) setMinMValue : (double ) m {
206
234
[self setMinM: [[NSDecimalNumber alloc ] initWithDouble: m]];
207
235
}
208
236
237
+ -(double ) maxMValue {
238
+ return [_maxM doubleValue ];
239
+ }
240
+
209
241
-(void ) setMaxMValue : (double ) m {
210
242
[self setMaxM: [[NSDecimalNumber alloc ] initWithDouble: m]];
211
243
}
@@ -219,11 +251,11 @@ -(BOOL) isMeasured{
219
251
}
220
252
221
253
-(double ) xRange {
222
- return [_maxX doubleValue ] - [_minX doubleValue ];
254
+ return [self maxXValue ] - [self minXValue ];
223
255
}
224
256
225
257
-(double ) yRange {
226
- return [_maxY doubleValue ] - [_minY doubleValue ];
258
+ return [self maxYValue ] - [self minYValue ];
227
259
}
228
260
229
261
-(NSDecimalNumber *) zRange {
@@ -262,6 +294,22 @@ -(SFPoint *) topRight{
262
294
return [SFPoint pointWithX: _maxX andY: _maxY];
263
295
}
264
296
297
+ -(SFPoint *) leftMid {
298
+ return [SFPoint pointWithX: _minX andY: [[NSDecimalNumber alloc ] initWithDouble: [self midY ]]];
299
+ }
300
+
301
+ -(SFPoint *) bottomMid {
302
+ return [SFPoint pointWithX: [[NSDecimalNumber alloc ] initWithDouble: [self midX ]] andY: _minY];
303
+ }
304
+
305
+ -(SFPoint *) rightMid {
306
+ return [SFPoint pointWithX: _maxX andY: [[NSDecimalNumber alloc ] initWithDouble: [self midY ]]];
307
+ }
308
+
309
+ -(SFPoint *) topMid {
310
+ return [SFPoint pointWithX: [[NSDecimalNumber alloc ] initWithDouble: [self midX ]] andY: _maxY];
311
+ }
312
+
265
313
-(SFLine *) left {
266
314
return [SFLine lineWithPoint1: [self topLeft ] andPoint2: [self bottomLeft ]];
267
315
}
@@ -279,11 +327,11 @@ -(SFLine *) top{
279
327
}
280
328
281
329
-(double ) midX {
282
- return ([_minX doubleValue ] + [_maxX doubleValue ]) / 2.0 ;
330
+ return ([self minXValue ] + [self maxXValue ]) / 2.0 ;
283
331
}
284
332
285
333
-(double ) midY {
286
- return ([_minY doubleValue ] + [_maxY doubleValue ]) / 2.0 ;
334
+ return ([self minYValue ] + [self maxYValue ]) / 2.0 ;
287
335
}
288
336
289
337
-(SFPoint *) centroid {
@@ -308,10 +356,10 @@ -(SFGeometryEnvelope *) overlapWithEnvelope: (SFGeometryEnvelope *) envelope{
308
356
309
357
-(SFGeometryEnvelope *) overlapWithEnvelope : (SFGeometryEnvelope *) envelope withAllowEmpty : (BOOL ) allowEmpty {
310
358
311
- double minX = MAX ([self .minX doubleValue ], [envelope.minX doubleValue ]);
312
- double maxX = MIN ([self .maxX doubleValue ], [envelope.maxX doubleValue ]);
313
- double minY = MAX ([self .minY doubleValue ], [envelope.minY doubleValue ]);
314
- double maxY = MIN ([self .maxY doubleValue ], [envelope.maxY doubleValue ]);
359
+ double minX = MAX ([self minXValue ], [envelope minXValue ]);
360
+ double maxX = MIN ([self maxXValue ], [envelope maxXValue ]);
361
+ double minY = MAX ([self minYValue ], [envelope minYValue ]);
362
+ double maxY = MIN ([self maxYValue ], [envelope maxYValue ]);
315
363
316
364
SFGeometryEnvelope *overlap = nil ;
317
365
@@ -324,10 +372,10 @@ -(SFGeometryEnvelope *) overlapWithEnvelope: (SFGeometryEnvelope *) envelope wit
324
372
325
373
-(SFGeometryEnvelope *) unionWithEnvelope : (SFGeometryEnvelope *) envelope {
326
374
327
- double minX = MIN ([self .minX doubleValue ], [envelope.minX doubleValue ]);
328
- double maxX = MAX ([self .maxX doubleValue ], [envelope.maxX doubleValue ]);
329
- double minY = MIN ([self .minY doubleValue ], [envelope.minY doubleValue ]);
330
- double maxY = MAX ([self .maxY doubleValue ], [envelope.maxY doubleValue ]);
375
+ double minX = MIN ([self minXValue ], [envelope minXValue ]);
376
+ double maxX = MAX ([self maxXValue ], [envelope maxXValue ]);
377
+ double minY = MIN ([self minYValue ], [envelope minYValue ]);
378
+ double maxY = MAX ([self maxYValue ], [envelope maxYValue ]);
331
379
332
380
SFGeometryEnvelope *unionEnvelope = nil ;
333
381
@@ -343,27 +391,27 @@ -(BOOL) containsPoint: (SFPoint *) point{
343
391
}
344
392
345
393
-(BOOL ) containsPoint : (SFPoint *) point withEpsilon : (double ) epsilon {
346
- return [self containsX: [point.x doubleValue ] andY: [point.y doubleValue ] withEpsilon: epsilon];
394
+ return [self containsX: [point xValue ] andY: [point yValue ] withEpsilon: epsilon];
347
395
}
348
396
349
397
-(BOOL ) containsX : (double ) x andY : (double ) y {
350
398
return [self containsX: x andY: y withEpsilon: 0.0 ];
351
399
}
352
400
353
401
-(BOOL ) containsX : (double ) x andY : (double ) y withEpsilon : (double ) epsilon {
354
- return x >= [_minX doubleValue ] - epsilon && x <= [_maxX doubleValue ] + epsilon
355
- && y >= [_minY doubleValue ] - epsilon && y <= [_maxY doubleValue ] + epsilon;
402
+ return x >= [self minXValue ] - epsilon && x <= [self maxXValue ] + epsilon
403
+ && y >= [self minYValue ] - epsilon && y <= [self maxYValue ] + epsilon;
356
404
}
357
405
358
406
-(BOOL ) containsEnvelope : (SFGeometryEnvelope *) envelope {
359
407
return [self containsEnvelope: envelope withEpsilon: 0.0 ];
360
408
}
361
409
362
410
-(BOOL ) containsEnvelope : (SFGeometryEnvelope *) envelope withEpsilon : (double ) epsilon {
363
- return [_minX doubleValue ] - epsilon <= [envelope.minX doubleValue ]
364
- && [_maxX doubleValue ] + epsilon >= [envelope.maxX doubleValue ]
365
- && [_minY doubleValue ] - epsilon <= [envelope.minY doubleValue ]
366
- && [_maxY doubleValue ] + epsilon >= [envelope.maxY doubleValue ];
411
+ return [self minXValue ] - epsilon <= [envelope minXValue ]
412
+ && [self maxXValue ] + epsilon >= [envelope maxXValue ]
413
+ && [self minYValue ] - epsilon <= [envelope minYValue ]
414
+ && [self maxYValue ] + epsilon >= [envelope maxYValue ];
367
415
}
368
416
369
417
-(SFGeometry *) buildGeometry {
0 commit comments