/// <summary> /// Intersects all land area shapes with grid25 major grids /// </summary> private static void ListIntersectLandArea() { if (SetUpMInorGridShapefile()) { //enumerate all shapes in the land shapefile for (int n = 0; n < LandShapefile.NumShapes; n++) { //make sure there are no selections LandShapefile.SelectNone(); //select one shape LandShapefile.ShapeSelected[n] = true; //do the intersection, with the intersection result saved in the objSelected array var objSelected = new object(); Grid25Shapefile.SelectByShapefile(LandShapefile, tkSpatialRelation.srIntersects, SelectedOnly: true, ref objSelected); _intersectedMajorGrids = (int[])objSelected; //raise event if (StatusUpdate != null) { CreateInlandGridEventArgs e = new CreateInlandGridEventArgs(); e.Status = "Major grids intersected"; e.GridCount = _intersectedMajorGrids.Length; StatusUpdate(e); } PopulateMinorGrid(); if (GetMinorGridsWithinLand()) { ProcessInlandGrids(); } } } }
/// <summary> /// Intersects selected land shapes with grid25 major grid shapefiles /// </summary> private static void ListIntersectSelectedLandArea() { if (LandShapefile.NumSelected > 0 && SetUpMInorGridShapefile()) { //get the selected shape indexes var selectedShapesIndexes = MapInterActionHandler.SelectedShapeIndexes; //enumerate all selected shapes for (int n = 0; n < selectedShapesIndexes.Length; n++) { //clear all selections LandShapefile.SelectNone(); //select one shape in the selected shapes LandShapefile.ShapeSelected[selectedShapesIndexes[n]] = true; //intersect the selected shape with the major grid var objSelected = new object(); Grid25Shapefile.SelectByShapefile(LandShapefile, tkSpatialRelation.srIntersects, true, ref objSelected); _intersectedMajorGrids = (int[])objSelected; if (StatusUpdate != null) { CreateInlandGridEventArgs e = new CreateInlandGridEventArgs(); e.Status = "Major grids intersected"; e.GridCount = _intersectedMajorGrids.Length; StatusUpdate(e); } PopulateMinorGrid(); if (GetMinorGridsWithinLand()) { ProcessInlandGrids(); } } } }