// Find and return this rule from the passed in objects private NodeReductionRule FindMyRule(ESRI.ArcGIS.esriSystem.ISet Objectset) { if (Objectset.Count == 0) { return(null); } Objectset.Reset(); object obj; obj = Objectset.Next(); while (obj != null) { if (obj is CustomRulesCS.NodeReductionRule) { break; } obj = Objectset.Next(); } return((NodeReductionRule)obj); }
// Find and return this rule from the passed in objects private BisectorRule FindMyRule(ESRI.ArcGIS.esriSystem.ISet Objectset) { if (Objectset.Count == 0) { return(null); } Objectset.Reset(); object obj; obj = Objectset.Next(); while (obj != null) { if (obj is BisectorRule) { break; } obj = Objectset.Next(); } return((BisectorRule)obj); }
/// <summary> /// Check if the form is applicable to the given set of objects. In this case /// only the Raster Function object is used to check compatibility. /// </summary> /// <param name="objects">Set of object to check against.</param> /// <returns>Flag to specify whether the form is applicable.</returns> public bool Applies(ESRI.ArcGIS.esriSystem.ISet objects) { objects.Reset(); for (int i = 0; i < objects.Count; i++) { object currObject = objects.Next(); if (currObject is IRasterFunction) { IRasterFunction rasterFunction = (IRasterFunction)currObject; if (rasterFunction is IPersistVariant) { IPersistVariant myVariantObject = (IPersistVariant)rasterFunction; // Compare the ID from the function object with the ID's supported by this UI page. if (myVariantObject.ID.Compare(mySupportedID)) { return(true); } else { return(false); } } else { return(false); } } } return(false); }
public void SetObjects(ESRI.ArcGIS.esriSystem.ISet objects) { // supplies the page with the object(s) to be edited including the map, feature layer, // feature class, and renderer // note: the feature renderer passed in as part of Objects is the one created // in CreateCompatibleObject object pObj = null; if (objects.Count <= 0) return; objects.Reset(); pObj = objects.Next(); IMap pMap = null; IGeoFeatureLayer pGeoLayer = null; // in this implementation we need info from the map and the renderer while (pObj != null) { if (pObj is IMap) pMap = pObj as IMap; if (pObj is IGeoFeatureLayer) pGeoLayer = pObj as IGeoFeatureLayer; if (pObj is IFeatureRenderer) m_pRend = pObj as IFeatureRenderer; pObj = objects.Next(); } if ((pMap != null) & (pGeoLayer != null) & (m_pRend != null)) { m_Page.InitControls(m_pRend as IMultivariateRenderer, pMap, pGeoLayer); } }
public bool Applies(ESRI.ArcGIS.esriSystem.ISet objects) { object pObj = null; if (objects.Count <= 0) { return false; return false; } objects.Reset(); pObj = objects.Next(); while (! (pObj is IFeatureRenderer)) { pObj = objects.Next(); if (pObj == null) { return false; return false; } } return (pObj is IMultivariateRenderer); }
/// <summary> /// Supplies the page with the object(s) to be edited /// </summary> void IComPropertyPage.SetObjects(ESRI.ArcGIS.esriSystem.ISet objects) { if (objects == null || objects.Count == 0) { return; } m_activeView = null; m_targetLayer = null; objects.Reset(); object testObject; while ((testObject = objects.Next()) != null) { if (testObject is ILayer) { m_targetLayer = testObject as ILayer; } else if (testObject is IActiveView) { m_activeView = testObject as IActiveView; } //else //{ //IApplication app = testObject as IApplication //Use if needed //} } }
/// <summary> /// Supplies the page with the object(s) to be edited /// </summary> void IComPropertyPage.SetObjects(ESRI.ArcGIS.esriSystem.ISet objects) { if (objects == null || objects.Count == 0) { return; } //Prepare to hold on to editable objects if (m_objectBag == null) { m_objectBag = new Dictionary <string, object>(); } else { m_objectBag.Clear(); } objects.Reset(); object testObject; while ((testObject = objects.Next()) != null) { if (testObject != null) { m_editor = testObject as IEditor; break; } } if (m_editor != null) { IExtensionManager extensionManager = m_editor as IExtensionManager; //for (int index = 0; index < extensionManager.ExtensionCount; index++) //{ // System.Diagnostics.Debug.WriteLine(extensionManager.Extension[index].Name); //} UID osmEditorExtensionCLSID = new UIDClass(); osmEditorExtensionCLSID.Value = "{faa799f0-bdc7-4ca4-af0c-a8d591c22058}"; OSMEditorExtension osmEditorExtension = m_editor.Parent.FindExtensionByCLSID(osmEditorExtensionCLSID) as OSMEditorExtension; if (osmEditorExtension != null) { m_osmbaseURL = osmEditorExtension.OSMBaseURL; } } }
/// <summary> /// Indicates if the page applies to the specified objects /// Do not hold on to the objects here. /// </summary> bool IComPropertyPage.Applies(ESRI.ArcGIS.esriSystem.ISet objects) { if (objects == null || objects.Count == 0) { return(false); } bool isEditable = false; objects.Reset(); object testObject; while ((testObject = objects.Next()) != null) { if (testObject != null) { isEditable = true; } } return(isEditable); }
void OnChangeFeature(ESRI.ArcGIS.Geodatabase.IObject obj) { // Don't do anything if the extension is disabled if (IsExtensionEnabled != true) { return; } // Bail if this is not a valid NCGMP workspace if (m_DatabaseIsValid == false) { return; } #region "Groundwork" // Grab the FeatureClass name from the Row's Table (as an IDataset). IRow theRow = obj; ITable theTable = theRow.Table; IDataset theDS = (IDataset)theTable; string TableName = theDS.Name; // Parse the table name in order to strip out unneccessary bits of SDE tables ISQLSyntax nameParser = (ISQLSyntax)theDS.Workspace; string parsedDbName, parsedOwnerName, parsedTableName; nameParser.ParseTableName(TableName, out parsedDbName, out parsedOwnerName, out parsedTableName); #endregion #region "Calculate SymbolRotation" if (m_DatabaseUsesRepresentation == true) { if (parsedTableName == "OrientationPoints") { // Get the Azimuth from the feature - this is ugly -- why is this m_identifier a double? int Azimuth = (int)Math.Round((double)theRow.get_Value(theTable.FindField("Azimuth")), 0); // Calculate the stupid form of rotation... int Rotation = CalculateSymbolRotation(Azimuth); // Set the SymbolRotation Field theRow.set_Value(theTable.FindField("SymbolRotation"), double.Parse(Rotation.ToString())); } } #endregion // Debugging flag to turn off repositioning of related data when stations are edited: bool adjustLocations = false; if (adjustLocations == true) { #region "Adjust Samples/OrientationPoints to Match Stations" if (parsedTableName == "Stations") { // Cast the obj as a Feature in order to access Geometry information IFeature theStation = (IFeature)obj; IGeometry stationGeom = theStation.ShapeCopy; // Find related Samples IRelationshipClass stationSampleLink = commonFunctions.OpenRelationshipClass(m_EditWorkspace, "StationSampleLink"); ESRI.ArcGIS.esriSystem.ISet relatedSamples = stationSampleLink.GetObjectsRelatedToObject(obj); // Loop through the related Samples and set their Geometry to that of the Station relatedSamples.Reset(); IFeature aSample = (IFeature)relatedSamples.Next(); while (aSample != null) { aSample.Shape = stationGeom; aSample.Store(); aSample = (IFeature)relatedSamples.Next(); } // Find related OrientationPoints IRelationshipClass stationStructureLink = commonFunctions.OpenRelationshipClass(m_EditWorkspace, "StationOrientationPointsLink"); ESRI.ArcGIS.esriSystem.ISet relatedStructures = stationStructureLink.GetObjectsRelatedToObject(obj); // Loop through the related OrientationPoints and set their Geometry to that of the Station relatedStructures.Reset(); IFeature aStructure = (IFeature)relatedStructures.Next(); while (aStructure != null) { aStructure.Shape = stationGeom; aStructure.Store(); aStructure = (IFeature)relatedStructures.Next(); } } #endregion } }
/// <summary> /// Set the necessary objects required for the form. In this case /// the form is given an arguments object in edit mode, or is required /// to create one in create mode. After getting or creating the arguments /// object, template mode is checked for and handled. The template mode /// requires all parameters of the arguments object to converted to variables. /// </summary> /// <param name="objects">Set of objects required for the form.</param> public void SetObjects(ESRI.ArcGIS.esriSystem.ISet objects) { try { // Recurse through the objects objects.Reset(); for (int i = 0; i < objects.Count; i++) { object currObject = objects.Next(); // Find the properties to be set. if (currObject is IPropertySet) { IPropertySet uiParameters = (IPropertySet)currObject; object names, values; uiParameters.GetAllProperties(out names, out values); bool disableForm = false; try { disableForm = Convert.ToBoolean(uiParameters.GetProperty("RFxPropPageIsReadOnly")); } catch (Exception) { } if (disableForm) { isFormReadOnly = true; } else { isFormReadOnly = false; } // Check if the arguments object exists in the property set. object functionArgument = null; try { functionArgument = uiParameters.GetProperty("RFxArgument"); } catch (Exception) { } // If not, the form is in create mode. if (functionArgument == null) { #region Create Mode // Create a new arguments object. myArgs = new NDVICustomFunctionArguments(); // Create a new property and set the arguments object on it. uiParameters.SetProperty("RFxArgument", myArgs); // Check if a default raster is supplied. object defaultRaster = null; try { defaultRaster = uiParameters.GetProperty("RFxDefaultInputRaster"); } catch (Exception) { } if (defaultRaster != null) // If it is, set it to the raster property. { myArgs.Raster = defaultRaster; } // Check if the form is in template mode. templateMode = (bool)uiParameters.GetProperty("RFxTemplateEditMode"); if (templateMode) { // Since we are in create mode already, new variables have to be // created for each property of the arguments object. #region Create Variables if (defaultRaster != null) { // If a default raster is supplied and it is a variable, // there is no need to create one. if (defaultRaster is IRasterFunctionVariable) { myRasterVar = (IRasterFunctionVariable)defaultRaster; } else { // Create variable object for the InputRaster property. myRasterVar = new RasterFunctionVariableClass(); myRasterVar.Value = defaultRaster; myRasterVar.Name = "InputRaster"; myRasterVar.IsDataset = true; } } // Create a variable for the BandIndices property. myBandIndicesVar = new RasterFunctionVariableClass(); myBandIndicesVar.Name = "BandIndices"; // Use the default value from the arguments object myBandIndicesVar.Value = myArgs.BandIndices; // Set the variables created as properties on the arguments object. IRasterFunctionArguments rasterFunctionArgs = (IRasterFunctionArguments)myArgs; rasterFunctionArgs.PutValue("Raster", myRasterVar); rasterFunctionArgs.PutValue("BandIndices", myBandIndicesVar); #endregion } #endregion } else { #region Edit Mode // Get the arguments object from the property set. myArgs = (INDVICustomFunctionArguments)functionArgument; // Check if the form is in template mode. templateMode = (bool)uiParameters.GetProperty("RFxTemplateEditMode"); if (templateMode) { #region Edit Template // In template edit mode, the variables from the arguments object // are extracted. IRasterFunctionArguments rasterFunctionArgs = (IRasterFunctionArguments)myArgs; object raster = rasterFunctionArgs.GetValue("Raster"); // Create or Open the Raster variable. if (raster is IRasterFunctionVariable) { myRasterVar = (IRasterFunctionVariable)raster; } else { myRasterVar = new RasterFunctionVariableClass(); myRasterVar.Name = "InputRaster"; myRasterVar.Value = raster; } #endregion } #endregion } } } } catch (Exception exc) { string errorMsg = exc.Message; } }