private void GeometryService_RelationCompleted(object sender, RelationEventArgs args)
        {
            List <GeometryRelationPair> results = args.Results;

            foreach (GeometryRelationPair pair in results)
            {
                if (pointLayer.Graphics[pair.Graphic1Index].Attributes["Relation"] == null)
                {
                    pointLayer.Graphics[pair.Graphic1Index].Attributes["Relation"] =
                        string.Format("Within Polygon {0}", pair.Graphic2Index);
                }
                else
                {
                    pointLayer.Graphics[pair.Graphic1Index].Attributes["Relation"] +=
                        "," + pair.Graphic2Index.ToString();
                }

                if (polygonLayer.Graphics[pair.Graphic2Index].Attributes["Relation"] == null)
                {
                    polygonLayer.Graphics[pair.Graphic2Index].Attributes["Relation"] =
                        string.Format("Contains Point {0}", pair.Graphic1Index);
                }
                else
                {
                    polygonLayer.Graphics[pair.Graphic2Index].Attributes["Relation"] +=
                        "," + pair.Graphic1Index.ToString();
                }
            }

            ExecuteRelationButton.Visibility = Visibility.Visible;
        }
Example #2
0
 /// <summary>
 /// Raises the relation updating event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="Mediachase.Commerce.Catalog.Events.RelationEventArgs"/> instance containing the event data.</param>
 public void RaiseRelationUpdatingEvent(CatalogRelationDto sender, RelationEventArgs args)
 {
     if (RelationUpdating != null)
     {
         RelationUpdating(sender, args);
     }
 }
        private void GeometryService_RelationCompleted(object sender, RelationEventArgs args)
        {
            List<GeometryRelationPair> results = args.Results;
            foreach (GeometryRelationPair pair in results)
            {
                if (pointLayer.Graphics[pair.Graphic1Index].Attributes["Relation"] == null)
                {
                    pointLayer.Graphics[pair.Graphic1Index].Attributes["Relation"] =
                    string.Format("Within Polygon {0}", pair.Graphic2Index);
                }
                else
                {
                    pointLayer.Graphics[pair.Graphic1Index].Attributes["Relation"] +=
                    "," + pair.Graphic2Index.ToString();
                }

                if (polygonLayer.Graphics[pair.Graphic2Index].Attributes["Relation"] == null)
                {
                    polygonLayer.Graphics[pair.Graphic2Index].Attributes["Relation"] =
                    string.Format("Contains Point {0}", pair.Graphic1Index);
                }
                else
                {
                    polygonLayer.Graphics[pair.Graphic2Index].Attributes["Relation"] +=
                    "," + pair.Graphic1Index.ToString();
                }
            }

            ExecuteRelationButton.Visibility = Visibility.Visible;
            MyDrawObject.IsEnabled = true;
        }
Example #4
0
 private void project_RelationAdded(object sender, RelationEventArgs e)
 {
     toolNewAssociation.Checked     = false;
     toolNewComposition.Checked     = false;
     toolNewAggregation.Checked     = false;
     toolNewGeneralization.Checked  = false;
     toolNewRealization.Checked     = false;
     toolNewDependency.Checked      = false;
     toolNewNesting.Checked         = false;
     toolNewCommentRelation.Checked = false;
 }
        void geometryService_RelationCompleted(object sender, RelationEventArgs e)
        {
            object[] state = e.UserState as object[];
            if (state == null || state.Length < 1)
                return;

            FindNearbyEventArgs eventArgs = state[0] as FindNearbyEventArgs;
            if (eventArgs == null)
                return;            

            GraphicsLayer layerToCompare = eventArgs.SelectedLayer;
            if (layerToCompare == null)
                return;

            GraphicsLayer resultsLayer = new GraphicsLayer() {                  
                 Opacity = layerToCompare.Opacity,                         
            };
            if (layerToCompare.Renderer != null)
                resultsLayer.Renderer = layerToCompare.Renderer.CloneRenderer();
            GraphicsLayer bufferGraphicsLayer = null;
            if(state.Length > 1)
                bufferGraphicsLayer = state[1] as GraphicsLayer;            
            
            foreach (GeometryRelationPair geomPair in e.Results)
            {
                int index = geomPair.Graphic1Index;
                if (index < 0 || index >= layerToCompare.Graphics.Count)
                    continue;
                Graphic intersectingGraphic = layerToCompare.Graphics[index];
                resultsLayer.Graphics.Add(copyGraphic(intersectingGraphic));
            }

            CopyLayerConfiguration(layerToCompare, resultsLayer);
            int insertIndex = Map.Layers.IndexOf(layerToCompare);
            string displayName = getDisplayNameForResultLayer(eventArgs.LayerDisplayName);
            AddResultLayer(bufferGraphicsLayer, true, Resources.Strings.FindNearbyBufferPrefix + displayName, ESRI.ArcGIS.Mapping.Core.GeometryType.Polygon, insertIndex);
            AddResultLayer(resultsLayer, true, Resources.Strings.FindNearbyPrefix + displayName, Core.LayerExtensions.GetGeometryType(layerToCompare), insertIndex);            
            if (findNearbyToolWindow != null)
            {
                findNearbyToolWindow.StopBusyIndicator();
                MapApplication.Current.HideWindow(findNearbyToolWindow);
            }
        }
Example #6
0
 public void RelationUpdated(object source, RelationEventArgs args)
 {
 }
        public void RelationUpdating(object source, RelationEventArgs args)
        {
            var relationDto = (CatalogRelationDto)source;

            relationDto.NodeEntryRelation.NodeEntryRelationRowChanging += (sender, e) => NodeEntryRelationRowChanging(sender, e);
        }
 private void InstanceOnLocalRelationUpdating(object sender, RelationEventArgs relationEventArgs)
 {
     _log.Debug("Relation Updating ({0}): {1}", relationEventArgs.EventName, sender.GetType().Name);
     RelationUpdating(sender, relationEventArgs);
 }
 private void InstanceOnLocalRelationUpdating(object sender, RelationEventArgs relationEventArgs)
 {
     _log.Debug("Relation Updating ({0}): {1}", relationEventArgs.EventName, sender.GetType().Name);
     RelationUpdating(sender, relationEventArgs);
 }
        public void RelationUpdating(object source, RelationEventArgs args)
        {
            var relationDto = (CatalogRelationDto)source;

            relationDto.NodeEntryRelation.NodeEntryRelationRowChanging += (sender, e) => NodeEntryRelationRowChanging(sender, e);
        }
        void geometryService_RelationCompleted(object sender, RelationEventArgs e)
        {
            object[] state = e.UserState as object[];
            if (state == null || state.Length < 1)
            {
                return;
            }

            FindNearbyEventArgs eventArgs = state[0] as FindNearbyEventArgs;

            if (eventArgs == null)
            {
                return;
            }

            GraphicsLayer layerToCompare = eventArgs.SelectedLayer;

            if (layerToCompare == null)
            {
                return;
            }

            GraphicsLayer resultsLayer = new GraphicsLayer()
            {
                Opacity = layerToCompare.Opacity,
            };

            if (layerToCompare.Renderer != null)
            {
                resultsLayer.Renderer = layerToCompare.Renderer.CloneRenderer();
            }
            GraphicsLayer bufferGraphicsLayer = null;

            if (state.Length > 1)
            {
                bufferGraphicsLayer = state[1] as GraphicsLayer;
            }

            foreach (GeometryRelationPair geomPair in e.Results)
            {
                int index = geomPair.Graphic1Index;
                if (index < 0 || index >= layerToCompare.Graphics.Count)
                {
                    continue;
                }
                Graphic intersectingGraphic = layerToCompare.Graphics[index];
                resultsLayer.Graphics.Add(copyGraphic(intersectingGraphic));
            }

            CopyLayerConfiguration(layerToCompare, resultsLayer);
            int    insertIndex = Map.Layers.IndexOf(layerToCompare);
            string displayName = getDisplayNameForResultLayer(eventArgs.LayerDisplayName);

            AddResultLayer(bufferGraphicsLayer, true, Resources.Strings.FindNearbyBufferPrefix + displayName, ESRI.ArcGIS.Mapping.Core.GeometryType.Polygon, insertIndex);
            AddResultLayer(resultsLayer, true, Resources.Strings.FindNearbyPrefix + displayName, Core.LayerExtensions.GetGeometryType(layerToCompare), insertIndex);
            if (findNearbyToolWindow != null)
            {
                findNearbyToolWindow.StopBusyIndicator();
                MapApplication.Current.HideWindow(findNearbyToolWindow);
            }
        }