したがって、2 つの MKMapRect を受け取り、2 番目の関数が最初の関数と交差する関数があります。したがって、関数は、交差部分のない最初の四角形である MKPolygon を作成します。
-(void) polygons:(MKMapRect)fullRect exclude:(MKMapRect)excludeArea{
NSLog(@"Y is: %f height: %f",excludeArea.origin.y,excludeArea.size.height);
double top = excludeArea.origin.y - fullRect.origin.y;
double lft = excludeArea.origin.x - fullRect.origin.x;
double btm = (fullRect.origin.y + fullRect.size.height) - (excludeArea.origin.y + excludeArea.size.height);
double rgt = (fullRect.origin.x + fullRect.size.width) - (excludeArea.origin.x + excludeArea.size.width);
double ot = fullRect.origin.y, it = (ot + top);
double ol = fullRect.origin.x, il = (ol + lft);
double ob = (fullRect.origin.y + fullRect.size.height), ib = (ob - btm);
double or = (fullRect.origin.x + fullRect.size.width), ir = (or - rgt);
MKMapPoint points[11] = {{ol,it}, {ol,ot}, {or,ot}, {or,ob}, {ol,ob}, {ol,it}, {il,it}, {ir,it}, {ir,ib}, {il,ib}, {il,it}};
MKPolygon *polygon = [MKPolygon polygonWithPoints:points count:11];
}
私の質問は、この MKPolygon から MKMapRects の最小数を取得するにはどうすればよいですか? フォーラムを調べたり、グーグルで調べたりしましたが、何も見つかりませんでした。
EDIT:したがって、目標は次のとおりです。MKMapRect rect1があり、次に長方形のリストrectListがあります。これは、rect1と交差するMKMapRectsであり、rect1の直線的なMKPolygonを作成し、すべての表面を削除しますrect1 から rectList 内の MKMapRects を作成し、作成された直線 MKPolygon から最小数の MKMaprects を作成します。
現在、問題は次のとおりです。rect1 から 1 つの MKMapRect を削除するとポリゴンを作成できますが、次の maprects を rect1 から削除する方法がわかりません。作成されたポリゴンから MkMapRects の最小セットを抽出する方法もわかりません。
よろしくピープ