m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeAdvanced }, new esriLicenseExtensionCode[] { }); //ESRI License Initializer generated code. String path = args[1]; //Path to map document float xMin = float.Parse(args[2]); //New extent xmin float yMin = float.Parse(args[3]); //New extent ymin float xMax = float.Parse(args[4]); //New extent xmax float yMax = float.Parse(args[5]); //New extent ymax IMapDocument mapDoc = new MapDocument(); if (mapDoc.get_IsMapDocument(path)) { mapDoc.Open(path, null); IMap map; for (int i = 0; i <= mapDoc.MapCount - 1; i++) { map = mapDoc.get_Map(i); IMap currMap = map; IEnvelope env = new EnvelopeClass(); IPoint llpoint = new PointClass(); llpoint.X = xMin; llpoint.Y = yMin; env.LowerLeft = llpoint; IPoint trpoint = new PointClass(); trpoint.X = xMax; trpoint.Y = yMax; env.UpperRight = trpoint; env.LowerLeft = llpoint; env.UpperRight = trpoint; IClone sClone = currMap.SpatialReference as IClone; //Assuming the map document has the correct spatial reference. ISpatialReference newSR = sClone.Clone() as ISpatialReference; env.SpatialReference = newSR; currMap.AreaOfInterest = env; } mapDoc.Save(); } //Do not make any call to ArcObjects after ShutDownApplication() m_AOLicenseInitializer.ShutdownApplication(); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.