/// <summary> /// Gets all the symbols available for a particular geometry /// </summary> /// <param name="geometry"></param> /// <returns></returns> private async Task <Dictionary <CIMSymbol, string> > GetSymbolDataMapping(GeometryType geometry) { var myDictionary = new Dictionary <CIMSymbol, string>(); switch (geometry) { case GeometryType.Point: styleItemType = StyleItemType.PointSymbol; myDictionary = await MyPointSymbology.GetAllPointSymbolsAsync(); break; case GeometryType.Polygon: styleItemType = StyleItemType.PolygonSymbol; myDictionary = await MyPolygonSymbology.GetAllPolygonSymbolsAsync(); break; case GeometryType.Polyline: styleItemType = StyleItemType.LineSymbol; myDictionary = await MyLineSymbology.GetAllLineSymbolsAsync(); break; case GeometryType.Multipatch: styleItemType = StyleItemType.MeshSymbol; myDictionary = await MeshSymbology.GetAll3DSymbolsAsync(); break; } return(myDictionary); }
private void UpdateColorLocking(StyleProjectItem style, StyleItemType type) { IList <SymbolStyleItem> items = style.SearchSymbols(type, String.Empty); foreach (var item in items) { var symbol = item.GetObject() as CIMMultiLayerSymbol; if (symbol == null) { continue; } if (item.Category.IndexOf("Frame") == 0) { if (symbol is CIMPointSymbol) { SetFramePrimitiveNames(symbol as CIMPointSymbol, item.Key); } } else if (item.Category.IndexOf("Main Icon") != -1 || item.Category.IndexOf("Modifier 1") != -1 || item.Category.IndexOf("Modifier 2") != -1) { SetIconPrimitiveNames(symbol as CIMPointSymbol, true); } // update the symbol item.SetObject(symbol); style.UpdateItem(item); } }
private async void GetSearchResults(object parameter) { //Clear for new search if (_styleItems.Count != 0) { _styleItems.Clear(); } //Get results and populate symbol gallery if (_selectedChoice == "Line symbols") { _itemTypeToSearch = StyleItemType.LineSymbol; } else if (_selectedChoice == "Polygon symbols") { _itemTypeToSearch = StyleItemType.PolygonSymbol; } else { _itemTypeToSearch = StyleItemType.PointSymbol; } //Search for symbols in the selected style _styleItems = await SelectedStyleProjectItem.SearchSymbolsAsync(_itemTypeToSearch, _searchString); NotifyPropertyChanged(() => StyleItems); NotifyPropertyChanged(() => StyleProjectItems); NotifyPropertyChanged(() => SearchResultCommand); }
public static async Task <List <GeometrySymbolItem> > GetStyleItemsAsync(StyleItemType styleItemType) { //Collection to hold the symbols in the various Style project items var geometrySymbolStyleItems = new List <GeometrySymbolItem>(); //Collection to hold all the StyleProjectitems List <StyleProjectItem> styleProjectItems = new List <StyleProjectItem>(); await QueuedTask.Run(() => { //First get the Favorite style var containerStyle = Project.Current.GetProjectItemContainer("Style"); styleProjectItems.Add(containerStyle.GetItems().OfType <StyleProjectItem>().First(item => item.TypeID == "personal_style")); //All other styles like 2D, 3D etc styleProjectItems.AddRange(Project.Current?.GetItems <StyleProjectItem>()); //Search for specific symbols and add them to geometrySymbolStyleItems collection foreach (var styleProjectitem in styleProjectItems) { foreach (var styleItem in styleProjectitem.SearchSymbols(styleItemType, "")) { geometrySymbolStyleItems.Add(new GeometrySymbolItem(styleItem, styleProjectitem.Name)); } } }); return(geometrySymbolStyleItems); }
private async Task <StyleItemType> GetSelectedTypeFromGraphicsLayerAsync(GraphicsLayer graphicsLayers) { StyleItemType styleItemType = StyleItemType.PointSymbol; //default //Get all selected graphics List <Element> selectedElements = graphicsLayers.GetSelectedElements().ToList(); if (selectedElements.Count == 0) { return(styleItemType); } //Convert "Element" list to "GraphicElement" list. var selectedGraphicElements = selectedElements.ConvertAll(x => (GraphicElement)x); //Get the type of the first graphic to compare against var firstGraphicElement = selectedElements.FirstOrDefault() as GraphicElement; await QueuedTask.Run(() => { var firstGraphicElementType = firstGraphicElement.GetGraphic().GetType(); //iterate to check if elements match var differentGraphicTypes = selectedGraphicElements.FirstOrDefault(se => se.GetGraphic().GetType() != firstGraphicElementType); if (differentGraphicTypes == null) //Find out what that type is { var graphicElement = selectedElements.FirstOrDefault() as GraphicElement; if (graphicElement.GetGraphic() is CIMPointGraphic) { styleItemType = StyleItemType.PointSymbol; } if (graphicElement.GetGraphic() is CIMTextGraphic) { styleItemType = StyleItemType.TextSymbol; } if (graphicElement.GetGraphic() is CIMLineGraphic) { styleItemType = StyleItemType.LineSymbol; } if (graphicElement.GetGraphic() is CIMPolygonGraphic) { styleItemType = StyleItemType.PolygonSymbol; } } }); return(styleItemType); }
private async Task GetStyleItemForLayerAsync(MapMember mapMember) { StyleItemType styleItemType = StyleItemType.Color; //Selected layer is a FeatureLayer if (mapMember is FeatureLayer) { var featureLayer = mapMember as FeatureLayer; var featureShapeType = featureLayer.ShapeType; switch (featureShapeType) { case esriGeometryType.esriGeometryPoint: styleItemType = StyleItemType.PointSymbol; break; case esriGeometryType.esriGeometryMultipoint: styleItemType = StyleItemType.PointSymbol; break; case esriGeometryType.esriGeometryLine: styleItemType = StyleItemType.LineSymbol; break; case esriGeometryType.esriGeometryPolyline: styleItemType = StyleItemType.LineSymbol; break; case esriGeometryType.esriGeometryPolygon: styleItemType = StyleItemType.PolygonSymbol; break; default: break; } SelectedStyleItemType = styleItemType; } //Selected Layer is a GraphicsLayer if (mapMember is GraphicsLayer) { await GetStyleItemForGraphicsLayerAsync(mapMember as GraphicsLayer); } }
public Task <bool> DoesStyleItemExists(StyleItemType styleItemType, string key) { var styleItemExists = QueuedTask.Run(() => { bool styleItem = false; //Search for a specific point symbol in style SymbolStyleItem item = (SymbolStyleItem)_styleProjectItem?.LookupItem(styleItemType, key); if (item == null) { styleItem = false; } else { styleItem = true; } return(styleItem); }); return(styleItemExists); }
static public Dictionary <string, StyleItem> ReadSymbolItems(StyleProjectItem style, StyleItemType itemType) { Dictionary <string, StyleItem> items = new Dictionary <string, StyleItem>(); IList <SymbolStyleItem> pointItems = style.SearchSymbols(itemType, ""); foreach (var item in pointItems) { if (!items.ContainsKey(item.Key)) { items.Add(item.Key, item); } } return(items); }
private async void GetSearchResults(object parameter) { //Clear for new search if (_styleItems.Count != 0) _styleItems.Clear(); //Get results and populate symbol gallery if (_selectedChoice == "Line symbols") _itemTypeToSearch = StyleItemType.LineSymbol; else if (_selectedChoice == "Polygon symbols") _itemTypeToSearch = StyleItemType.PolygonSymbol; else _itemTypeToSearch = StyleItemType.PointSymbol; //Search for symbols in the selected style _styleItems = await SelectedStyleProjectItem.SearchItemsAsync(_itemTypeToSearch, _searchString); NotifyPropertyChanged(() => StyleItems); NotifyPropertyChanged(() => StyleProjectItems); NotifyPropertyChanged(() => SearchResultCommand); }