public void WriteSwatches(ValueMapRenderer renderer, string directory, string layerID) { for (int i = 0; i < renderer.Classifications.Count; ++i) { string outFileName = directory + "\\" + GetSwatchName(_service, layerID, i) + ".png"; WriteSwatch(renderer.Classifications[i].Symbol, outFileName); } }
public Bitmap[] GetSwatches(ValueMapRenderer renderer) { List <Bitmap> swatches = new List <Bitmap>(); foreach (Classification classification in renderer.Classifications) { swatches.Add(GetSwatch(classification.Symbol)); } return(swatches.ToArray()); }
public object PropertyPanel(IFeatureRenderer renderer, IFeatureLayer layer) { if (layer != null) { _fc = layer.FeatureClass; } _renderer = renderer as ValueMapRenderer; if (_fc == null || _renderer == null) { return(null); } _renderer.GeometryType = layer.LayerGeometryType; // _fc.GeometryType; foreach (IField field in _fc.Fields) { if (field.type == FieldType.binary || field.type == FieldType.Shape) { continue; } cmbFields.Items.Add(field.name); if (field.name == _renderer.ValueField) { cmbFields.SelectedIndex = cmbFields.Items.Count - 1; } } btnRotation.Enabled = (_fc.GeometryType == geometryType.Point || _fc.GeometryType == geometryType.Multipoint); if (cmbFields.SelectedIndex == -1) { cmbFields.SelectedIndex = 0; } symbolsListView1.OnSymbolChanged += new gView.Framework.UI.Controls.SymbolsListView.SymbolChanged(symbolsListView1_OnSymbolChanged); symbolsListView1.OnLabelChanged += new gView.Framework.UI.Controls.SymbolsListView.LabelChanged(symbolsListView1_OnLabelChanged); symbolsListView1.OnDeleteItem += new gView.Framework.UI.Controls.SymbolsListView.DeleteItem(symbolsListView1_OnDeleteItem); BuildList(); return(panel1); }
private List <TocGroup> LoadTocGroups(Renderer renderer, SwatchMaker swatchMaker, bool includeImages) { List <TocGroup> tocGroups = new List <TocGroup>(); switch (renderer.GetType().Name) { case "SimpleRenderer": tocGroups.Add(new TocGroup()); SimpleRenderer sr = (SimpleRenderer)renderer; tocGroups[0].Add(LoadTocClass(sr.Symbol, swatchMaker, includeImages)); break; case "ValueMapRenderer": tocGroups.Add(new TocGroup()); ValueMapRenderer vmr = (ValueMapRenderer)renderer; foreach (Classification classification in vmr.Classifications) { string label = ""; switch (classification.GetType().Name) { case "Exact": Exact exact = (Exact)classification; label = !String.IsNullOrEmpty(exact.Label) ? exact.Label : exact.Value; break; case "Range": Range range = (Range)classification; label = !String.IsNullOrEmpty(range.Label) ? range.Label : range.Lower + " to " + range.Upper; break; case "Other": label = "(other)"; break; } tocGroups[0].Add(LoadTocClass(classification.Symbol, swatchMaker, label, includeImages)); } break; case "ScaleDependentRenderer": ScaleDependentRenderer scd = (ScaleDependentRenderer)renderer; tocGroups = LoadTocGroups(scd.Renderer, swatchMaker, includeImages); foreach (TocGroup tocGroup in tocGroups) { if (!String.IsNullOrEmpty(scd.Lower)) { tocGroup.MinScale = Convert.ToDouble(scd.Lower); } if (!String.IsNullOrEmpty(scd.Upper)) { tocGroup.MaxScale = Convert.ToDouble(scd.Upper); } } break; case "GroupRenderer": foreach (Renderer subRenderer in (GroupRenderer)renderer) { List <TocGroup> subGroups = LoadTocGroups(subRenderer, swatchMaker, includeImages); foreach (TocGroup tocGroup in subGroups) { tocGroups.Add(tocGroup); } } break; } return(tocGroups); }