static GisEditor() { serializer = new GisEditorGeoSerializer(); infrastructureManager = CreateManager <InfrastructureManager>(); Collection <Manager> managers = infrastructureManager.GetManagers(); ProjectManager.CurrentProjectPlugin = ProjectManager.GetProjectPlugins().OrderBy(p => p.Index).FirstOrDefault(); managers.OfType <PluginManager>().ForEach(m => m.GetPlugins()); infrastructureManager.ApplySettings(managers.OfType <PluginManager>().SelectMany(m => m.GetPlugins())); }
private static void SaveLayer(Layer layer) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "ThinkGeo layer files (*.tglyr)|*.tglyr"; if (saveFileDialog.ShowDialog().GetValueOrDefault()) { var folder = Path.GetDirectoryName(saveFileDialog.FileName); GeoSerializer geoSerializer = new GeoSerializer(); var layerXml = geoSerializer.Serialize(layer); var rootXml = XElement.Parse(layerXml); rootXml.Save(saveFileDialog.FileName); } }
public override Dictionary <string, string> SaveState() { Dictionary <string, string> state = base.SaveState(); state.Add("IsAttributePrompted", IsAttributePrompted.ToString()); state.Add("VertexCountInQuarter", VertexCountInQuarter.ToString()); try { GeoSerializer serializer = new GeoSerializer(); state.Add("EditCompositeStyle", serializer.Serialize(EditCompositeStyle)); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } return(state); }
public override void LoadState(Dictionary <string, string> state) { base.LoadState(state); PluginHelper.RestoreBoolean(state, "IsAttributePrompted", v => IsAttributePrompted = v); PluginHelper.RestoreInteger(state, "VertexCountInQuarter", v => VertexCountInQuarter = v); PluginHelper.Restore(state, "EditCompositeStyle", v => { GeoSerializer serializer = new GeoSerializer(); try { EditCompositeStyle = (CompositeStyle)serializer.Deserialize(v); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } }); }
public override Dictionary <string, string> SaveState() { var resultState = base.SaveState(); resultState["MeasureDistanceUnit"] = SelectedDistanceUnit.ToString(); resultState["MeasureAreaUnit"] = SelectedAreaUnit.ToString(); resultState["AllowCollectFixedElements"] = AllowCollectFixedElements.ToString(); resultState["UseGdiPlusInsteadOfDrawingVisual"] = UseGdiPlusInsteadOfDrawingVisual.ToString(); try { GeoSerializer serializer = new GeoSerializer(); resultState.Add("MeasurementStyle", serializer.Serialize(MeasurementStyle)); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } return(resultState); }
protected override StorableSettings GetSettingsCore() { var settings = base.GetSettingsCore(); var viewMode = selectionAndQueryingGroup.DataContext as SelectionAndQueryingRibbonGroupViewModel; if (viewMode != null) { try { GeoSerializer serializer = new GeoSerializer(); settings.GlobalSettings["SelectionCompositeStyle"] = serializer.Serialize(viewMode.SelectionCompositeStyle); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } } return(settings); }
protected override void ApplySettingsCore(StorableSettings settings) { base.ApplySettingsCore(settings); var viewMode = selectionAndQueryingGroup.DataContext as SelectionAndQueryingRibbonGroupViewModel; if (viewMode != null) { GeoSerializer serializer = new GeoSerializer(); if (settings.GlobalSettings.ContainsKey("SelectionCompositeStyle")) { try { viewMode.SelectionCompositeStyle = (CompositeStyle)serializer.Deserialize(settings.GlobalSettings["SelectionCompositeStyle"]); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } } } }
public override void LoadState(System.Collections.Generic.Dictionary <string, string> state) { base.LoadState(state); PluginHelper.Restore(state, "MeasureDistanceUnit", tmpString => { DistanceUnit currentDistanceUnit = DistanceUnit.Meter; if (Enum.TryParse(tmpString, out currentDistanceUnit)) { SelectedDistanceUnit = currentDistanceUnit; } }); PluginHelper.Restore(state, "MeasureAreaUnit", tmpString => { AreaUnit currentAreaUnit = AreaUnit.SquareMeters; if (Enum.TryParse(tmpString, out currentAreaUnit)) { SelectedAreaUnit = currentAreaUnit; } }); PluginHelper.RestoreBoolean(state, "AllowCollectFixedElements", v => AllowCollectFixedElements = v); PluginHelper.RestoreBoolean(state, "UseGdiPlusInsteadOfDrawingVisual", v => UseGdiPlusInsteadOfDrawingVisual = v); PluginHelper.Restore(state, "MeasurementStyle", v => { GeoSerializer serializer = new GeoSerializer(); try { MeasurementStyle = (CompositeStyle)serializer.Deserialize(v); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } }); }
private FeatureSource GetFeatureSourceFromString(string xml) { GeoSerializer serializer = new GeoSerializer(); return((FeatureSource)serializer.Deserialize(xml)); }