[mapguide-commits] r6266 - in trunk/Tools/Maestro:
Maestro.Base/Commands Maestro.Base/UI/Preferences
Maestro.Editors/LayerDefinition/Vector/Scales
Maestro.Editors/LayerDefinition/Vector/StyleEditors
Maestro.Editors/LayerDefinition/Vector/Thematics
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Nov 30 06:16:15 EST 2011
Author: jng
Date: 2011-11-30 03:16:15 -0800 (Wed, 30 Nov 2011)
New Revision: 6266
Modified:
trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs
trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs
trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.Designer.cs
trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionList.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/FontStyleEditor.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/PointFeatureStyleEditor.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs
Log:
Undo previous submission. The changes were too destructive.
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -40,8 +40,6 @@
ResourceService.RegisterNeutralImages(Properties.Resources.ResourceManager);
ResourceService.RegisterNeutralStrings(Properties.Resources.ResourceManager);
- Maestro.Editors.LayerDefinition.Vector.Scales.StylePreview.UseClientSideStylePreview = PropertyService.Get(ConfigProperties.UseClientSideStylePreview, ConfigProperties.DefaultUseClientSideStylePreview);
-
ServiceRegistry.Initialize();
EventWatcher.Initialize();
Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -40,7 +40,6 @@
public const string ValidateOnSave = "General.ValidateResourceOnSave";
public const string XsdSchemaPath = "Editor.XsdSchemaPath";
public const string ShowTipOfTheDay = "General.ShowTipOfTheDay";
- public const string UseClientSideStylePreview = "Editor.UseClientSideStylePreview";
internal static void ApplyDefaults()
{
@@ -52,7 +51,6 @@
{
Props.Set(ConfigProperties.ValidateOnSave, DefaultValidateOnSave);
Props.Set(ConfigProperties.XsdSchemaPath, DefaultXsdSchemaPath);
- Props.Set(ConfigProperties.UseClientSideStylePreview, DefaultUseClientSideStylePreview);
}
internal static void ApplyGeneralDefaults()
@@ -89,7 +87,5 @@
public static string DefaultPreviewViewerType { get { return "AJAX"; } }
public static string DefaultUserTemplatesDirectory { get { return Path.Combine(FileUtility.ApplicationRootPath, "UserTemplates"); } }
-
- public static bool DefaultUseClientSideStylePreview { get { return true; } }
}
}
Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.Designer.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.Designer.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -32,14 +32,10 @@
this.chkValidateOnSave = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnBrowseXsdPath = new System.Windows.Forms.Button();
- this.label4 = new System.Windows.Forms.Label();
this.txtXsdPath = new System.Windows.Forms.TextBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.chkUseClientSidePreviews = new System.Windows.Forms.CheckBox();
- this.label1 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
this.groupBox4.SuspendLayout();
this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox4
@@ -91,16 +87,6 @@
this.btnBrowseXsdPath.UseVisualStyleBackColor = true;
this.btnBrowseXsdPath.Click += new System.EventHandler(this.btnBrowseXsdPath_Click);
//
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.label4.Location = new System.Drawing.Point(15, 27);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(91, 13);
- this.label4.TabIndex = 12;
- this.label4.Text = "Xml Schema Path";
- //
// txtXsdPath
//
this.txtXsdPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -111,46 +97,20 @@
this.txtXsdPath.Size = new System.Drawing.Size(249, 20);
this.txtXsdPath.TabIndex = 13;
//
- // groupBox2
+ // label4
//
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Controls.Add(this.chkUseClientSidePreviews);
- this.groupBox2.Location = new System.Drawing.Point(4, 133);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(398, 116);
- this.groupBox2.TabIndex = 12;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Style Previews";
+ this.label4.AutoSize = true;
+ this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label4.Location = new System.Drawing.Point(15, 27);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(91, 13);
+ this.label4.TabIndex = 12;
+ this.label4.Text = "Xml Schema Path";
//
- // chkUseClientSidePreviews
- //
- this.chkUseClientSidePreviews.AutoSize = true;
- this.chkUseClientSidePreviews.ImeMode = System.Windows.Forms.ImeMode.NoControl;
- this.chkUseClientSidePreviews.Location = new System.Drawing.Point(18, 29);
- this.chkUseClientSidePreviews.Name = "chkUseClientSidePreviews";
- this.chkUseClientSidePreviews.Size = new System.Drawing.Size(156, 17);
- this.chkUseClientSidePreviews.TabIndex = 3;
- this.chkUseClientSidePreviews.Text = "Render previews client-side\r\n";
- this.chkUseClientSidePreviews.UseVisualStyleBackColor = true;
- //
- // label1
- //
- this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.label1.Location = new System.Drawing.Point(15, 61);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(366, 36);
- this.label1.TabIndex = 4;
- this.label1.Text = "un-checking the above item will use GetLegendImage API, which produces accurate p" +
- "reviews at the expense of performance for style heavy layers";
- //
// EditorPreferencesCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Name = "EditorPreferencesCtrl";
@@ -159,8 +119,6 @@
this.groupBox4.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
@@ -173,8 +131,5 @@
private System.Windows.Forms.Button btnBrowseXsdPath;
private System.Windows.Forms.TextBox txtXsdPath;
private System.Windows.Forms.Label label4;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.CheckBox chkUseClientSidePreviews;
- private System.Windows.Forms.Label label1;
}
}
Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/EditorPreferencesCtrl.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -37,9 +37,6 @@
var path = Props.Get(ConfigProperties.XsdSchemaPath, ConfigProperties.DefaultXsdSchemaPath);
txtXsdPath.Text = path;
-
- var clientStyle = Props.Get(ConfigProperties.UseClientSideStylePreview, ConfigProperties.DefaultUseClientSideStylePreview);
- chkUseClientSidePreviews.Checked = clientStyle;
}
public string Title
@@ -57,8 +54,6 @@
bool restart = false;
Apply(ConfigProperties.ValidateOnSave, chkValidateOnSave.Checked);
- Apply(ConfigProperties.UseClientSideStylePreview, chkUseClientSidePreviews.Checked);
- Maestro.Editors.LayerDefinition.Vector.Scales.StylePreview.UseClientSideStylePreview = chkUseClientSidePreviews.Checked;
//These changes require restart
if (Apply(ConfigProperties.XsdSchemaPath, txtXsdPath.Text))
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -68,27 +68,27 @@
_conn = conn;
}
- public void SetItem(IVectorScaleRange parentRange, IPointRule prt, int themeCategory)
+ public void SetItem(IPointRule prt)
{
- SetItemInternal(parentRange, prt, themeCategory);
+ SetItemInternal(prt);
}
- public void SetItem(IVectorScaleRange parentRange, ILineRule lrt, int themeCategory)
+ public void SetItem(ILineRule lrt)
{
- SetItemInternal(parentRange, lrt, themeCategory);
+ SetItemInternal(lrt);
}
- public void SetItem(IVectorScaleRange parentRange, IAreaRule art, int themeCategory)
+ public void SetItem(IAreaRule art)
{
- SetItemInternal(parentRange, art, themeCategory);
+ SetItemInternal(art);
}
- public void SetItem(IVectorScaleRange parentRange, ICompositeRule comp, int themeCategory)
+ public void SetItem(ICompositeRule comp)
{
- SetItemInternal(parentRange, comp, themeCategory);
+ SetItemInternal(comp);
}
- private void SetItemInternal(IVectorScaleRange parentRange, object item, int themeCategory)
+ private void SetItemInternal(object item)
{
m_prt = item as IPointRule;
m_lrt = item as ILineRule;
@@ -112,31 +112,31 @@
w2d = SymbolPicker.GetSymbol(_conn, sym.W2DSymbol.ResourceId, sym.W2DSymbol.LibraryItemName);
}
}
- FeatureStyle.SetItem(parentRange, m_prt, m_prt.PointSymbolization2D, w2d, themeCategory);
- LabelStyle.SetItem(parentRange, m_prt, m_prt.Label, themeCategory);
+ FeatureStyle.SetItem(m_prt, m_prt.PointSymbolization2D, w2d);
+ LabelStyle.SetItem(m_prt, m_prt.Label);
LabelStyle.Visible = true;
}
else if (m_lrt != null)
{
RuleCondition.Text = m_lrt.Filter;
LegendLabel.Text = m_lrt.LegendLabel;
- FeatureStyle.SetItem(parentRange, m_lrt, m_lrt.Strokes, themeCategory);
- LabelStyle.SetItem(parentRange, m_lrt, m_lrt.Label, themeCategory);
+ FeatureStyle.SetItem(m_lrt, m_lrt.Strokes);
+ LabelStyle.SetItem(m_lrt, m_lrt.Label);
LabelStyle.Visible = true;
}
else if (m_art != null)
{
RuleCondition.Text = m_art.Filter;
LegendLabel.Text = m_art.LegendLabel;
- FeatureStyle.SetItem(parentRange, m_art, m_art.AreaSymbolization2D, themeCategory);
- LabelStyle.SetItem(parentRange, m_art, m_art.Label, themeCategory);
+ FeatureStyle.SetItem(m_art, m_art.AreaSymbolization2D);
+ LabelStyle.SetItem(m_art, m_art.Label);
LabelStyle.Visible = true;
}
else if (m_comp != null)
{
RuleCondition.Text = m_comp.Filter;
LegendLabel.Text = m_comp.LegendLabel;
- FeatureStyle.SetItem(parentRange, m_comp, m_comp.CompositeSymbolization, themeCategory);
+ FeatureStyle.SetItem(m_comp, m_comp.CompositeSymbolization);
LabelStyle.Visible = false;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionList.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionList.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionList.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -110,7 +110,7 @@
m_comp = item as ICompositeTypeStyle;
this.Controls.Clear();
- int themeCategory = 0;
+
try
{
this.Visible = false;
@@ -119,34 +119,22 @@
if (m_point != null)
{
foreach (IPointRule prt in m_point.Rules)
- {
- AddRuleControl(prt, themeCategory);
- themeCategory++;
- }
+ AddRuleControl(prt);
}
else if (m_line != null)
{
foreach (ILineRule lrt in m_line.Rules)
- {
- AddRuleControl(lrt, themeCategory);
- themeCategory++;
- }
+ AddRuleControl(lrt);
}
else if (m_area != null)
{
foreach (IAreaRule art in m_area.Rules)
- {
- AddRuleControl(art, themeCategory);
- themeCategory++;
- }
+ AddRuleControl(art);
}
else if (m_comp != null)
{
foreach (ICompositeRule comp in m_comp.CompositeRule)
- {
- AddRuleControl(comp, themeCategory);
- themeCategory++;
- }
+ AddRuleControl(comp);
}
}
finally
@@ -156,7 +144,7 @@
}
}
- public Condition AddRuleControl(object rule, int themeCategory)
+ public Condition AddRuleControl(object rule)
{
if (rule == null)
return null;
@@ -165,13 +153,13 @@
Condition c = new Condition(m_owner.EditorService.GetEditedResource().CurrentConnection);
if (rule as IPointRule != null)
- c.SetItem(m_parent, rule as IPointRule, themeCategory);
+ c.SetItem(rule as IPointRule);
else if (rule as ILineRule != null)
- c.SetItem(m_parent, rule as ILineRule, themeCategory);
+ c.SetItem(rule as ILineRule);
else if (rule as IAreaRule != null)
- c.SetItem(m_parent, rule as IAreaRule, themeCategory);
+ c.SetItem(rule as IAreaRule);
else if (rule as ICompositeRule != null)
- c.SetItem(m_parent, rule as ICompositeRule, themeCategory);
+ c.SetItem(rule as ICompositeRule);
c.Owner = m_owner;
c.Dock = DockStyle.Top;
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -133,26 +133,26 @@
if (m_point != null)
{
IPointRule prt = _factory.CreateDefaultPointRule();
+ conditionList.AddRuleControl(prt).Focus();
m_point.AddRule(prt);
- conditionList.AddRuleControl(prt, m_point.RuleCount - 1).Focus();
}
else if (m_line != null)
{
ILineRule lrt = _factory.CreateDefaultLineRule();
+ conditionList.AddRuleControl(lrt).Focus();
m_line.AddRule(lrt);
- conditionList.AddRuleControl(lrt, m_line.RuleCount - 1).Focus();
}
else if (m_area != null)
{
IAreaRule art = _factory.CreateDefaultAreaRule();
+ conditionList.AddRuleControl(art).Focus();
m_area.AddRule(art);
- conditionList.AddRuleControl(art, m_area.RuleCount - 1).Focus();
}
else if (m_comp != null)
{
ICompositeRule cr = _factory.CreateDefaultCompositeRule();
+ conditionList.AddRuleControl(cr).Focus();
m_comp.AddCompositeRule(cr);
- conditionList.AddRuleControl(cr, m_comp.RuleCount - 1).Focus();
}
if (ItemChanged != null)
@@ -215,26 +215,23 @@
object rule = Utility.XmlDeepCopy(conditionList.SelectedItem);
- int themeCategory = -1;
+
if (m_point != null)
{
m_point.AddRule((IPointRule)rule);
- themeCategory = m_point.RuleCount - 1;
}
else if (m_line != null)
{
m_line.AddRule((ILineRule)rule);
- themeCategory = m_line.RuleCount - 1;
}
else if (m_area != null)
{
m_area.AddRule((IAreaRule)rule);
- themeCategory = m_area.RuleCount - 1;
}
else
return;
- conditionList.AddRuleControl(rule, themeCategory).Focus();
+ conditionList.AddRuleControl(rule).Focus();
if (ItemChanged != null)
ItemChanged(this, null);
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -27,7 +27,6 @@
using OSGeo.MapGuide.MaestroAPI;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
using Maestro.Editors.LayerDefinition.Vector.StyleEditors;
-using OSGeo.MapGuide.MaestroAPI.Services;
namespace Maestro.Editors.LayerDefinition.Vector.Scales
{
@@ -66,20 +65,19 @@
}
private ILayerElementFactory _factory;
- private IVectorScaleRange _parentRange;
public ItemStyle(ILayerElementFactory factory)
{
_factory = factory;
}
- public void SetItem(IVectorScaleRange parentRange, object parent, ITextSymbol label, int themeCategory)
+ public void SetItem(object parent, ITextSymbol label)
{
isLabel = true;
- SetItemInternal(parentRange, parent, label, themeCategory);
+ SetItemInternal(parent, label);
}
- public void SetItem(IVectorScaleRange parentRange, IPointRule parent, IPointSymbolization2D point, Image img, int themeCategory)
+ public void SetItem(IPointRule parent, IPointSymbolization2D point, Image img)
{
if (point == null)
{
@@ -91,34 +89,30 @@
isPoint = (point.Symbol.Type != PointSymbolType.W2D);
isW2dSymbol = (point.Symbol.Type == PointSymbolType.W2D);
}
- SetItemInternal(parentRange, parent, point, themeCategory);
+ SetItemInternal(parent, point);
m_w2dsymbol = img;
}
- public void SetItem(IVectorScaleRange parentRange, ILineRule parent, IEnumerable<IStroke> line, int themeCategory)
+ public void SetItem(ILineRule parent, IEnumerable<IStroke> line)
{
isLine = true;
- SetItemInternal(parentRange, parent, line, themeCategory);
+ SetItemInternal(parent, line);
}
- public void SetItem(IVectorScaleRange parentRange, IAreaRule parent, IAreaSymbolizationFill area, int themeCategory)
+ public void SetItem(IAreaRule parent, IAreaSymbolizationFill area)
{
isArea = true;
- SetItemInternal(parentRange, parent, area, themeCategory);
+ SetItemInternal(parent, area);
}
- public void SetItem(IVectorScaleRange parentRange, ICompositeRule parent, ICompositeSymbolization comp, int themeCategory)
+ public void SetItem(ICompositeRule parent, ICompositeSymbolization comp)
{
isComp = true;
- SetItemInternal(parentRange, parent, comp, themeCategory);
+ SetItemInternal(parent, comp);
}
- private int _themeCategory;
-
- private void SetItemInternal(IVectorScaleRange parentRange, object parent, object item, int themeCategory)
+ private void SetItemInternal(object parent, object item)
{
- _parentRange = parentRange;
- _themeCategory = themeCategory;
m_parent = parent;
m_label = item as ITextSymbol;
m_point = item as IPointSymbolization2D;
@@ -132,112 +126,66 @@
m_line = null;
}
- private IMappingService _mapSvc = null;
-
- IMappingService GetMappingService()
+ private void previewPicture_Paint(object sender, PaintEventArgs e)
{
- if (null == _mapSvc)
+ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
+ Rectangle rect = new Rectangle(0, 0, previewPicture.Width, previewPicture.Height);
+ if (m_label != null)
{
- var conn = Owner.EditorService.GetEditedResource().CurrentConnection;
- if (Array.IndexOf<int>(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
- _mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+ FeaturePreviewRender.RenderPreviewFont(e.Graphics, rect, m_label);
}
- return _mapSvc;
- }
-
- int GetGeomType()
- {
- int gt = -1;
- if (isPoint || isLabel || isW2dSymbol)
- return 1;
- else if (isLine)
- return 2;
- else if (isArea)
- return 3;
- else if (isComp)
- return 4;
- return gt;
- }
-
- private void previewPicture_Paint(object sender, PaintEventArgs e)
- {
- var mapSvc = GetMappingService();
- if (mapSvc != null && !StylePreview.UseClientSideStylePreview)
+ else if (m_point != null)
{
- double scale = 10000.0;
- if (_parentRange.MaxScale.HasValue)
- scale = _parentRange.MaxScale.Value - 1.0;
- else if (_parentRange.MinScale.HasValue)
- scale = _parentRange.MinScale.Value + 1.0;
-
- //Ensure the layer def we're rendering from is latest
- Owner.EditorService.SyncSessionCopy();
- using (var img = mapSvc.GetLegendImage(scale, Owner.EditorService.GetEditedResource().ResourceID, _themeCategory, GetGeomType(), previewPicture.Width, previewPicture.Height, "PNG"))
- {
- e.Graphics.DrawImage(img, new Point(0, 0));
- }
+ if (m_point.Symbol.Type == PointSymbolType.Mark)
+ FeaturePreviewRender.RenderPreviewPoint(e.Graphics, rect, m_point.Symbol as IMarkSymbol);
+ else if (m_point.Symbol.Type == PointSymbolType.Font)
+ FeaturePreviewRender.RenderPreviewFontSymbol(e.Graphics, rect, m_point.Symbol as IFontSymbol);
+ else if (m_point.Symbol.Type == PointSymbolType.W2D)
+ FeaturePreviewRender.RenderW2DImage(e.Graphics, rect, m_point.Symbol as IW2DSymbol, m_w2dsymbol);
+ }
+ else if (m_line != null)
+ {
+ FeaturePreviewRender.RenderPreviewLine(e.Graphics, rect, m_line);
}
- else
+ else if (m_area != null)
{
- e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
- Rectangle rect = new Rectangle(0, 0, previewPicture.Width, previewPicture.Height);
- if (m_label != null)
- {
- FeaturePreviewRender.RenderPreviewFont(e.Graphics, rect, m_label);
- }
- else if (m_point != null)
- {
- if (m_point.Symbol.Type == PointSymbolType.Mark)
- FeaturePreviewRender.RenderPreviewPoint(e.Graphics, rect, m_point.Symbol as IMarkSymbol);
- else if (m_point.Symbol.Type == PointSymbolType.Font)
- FeaturePreviewRender.RenderPreviewFontSymbol(e.Graphics, rect, m_point.Symbol as IFontSymbol);
- else if (m_point.Symbol.Type == PointSymbolType.W2D)
- FeaturePreviewRender.RenderW2DImage(e.Graphics, rect, m_point.Symbol as IW2DSymbol, m_w2dsymbol);
- }
- else if (m_line != null)
- {
- FeaturePreviewRender.RenderPreviewLine(e.Graphics, rect, m_line);
- }
- else if (m_area != null)
- {
- FeaturePreviewRender.RenderPreviewArea(e.Graphics, rect, m_area);
- }
- else if (m_comp != null)
- {
- FeaturePreviewRender.RenderNoPreview(e.Graphics, rect);
- }
- else
- FeaturePreviewRender.RenderPreviewFont(e.Graphics, rect, null);
+ FeaturePreviewRender.RenderPreviewArea(e.Graphics, rect, m_area);
}
+ else if (m_comp != null)
+ {
+ FeaturePreviewRender.RenderNoPreview(e.Graphics, rect);
+ }
+ else
+ FeaturePreviewRender.RenderPreviewFont(e.Graphics, rect, null);
}
private void EditButton_Click(object sender, EventArgs e)
{
- IFeatureStyleEditor uc = null;
+ UserControl uc = null;
if (isLabel)
{
- uc = new FontStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, m_label);
- //((FontStyleEditor)uc).Item = m_label == null ? null : (ITextSymbol)m_label.Clone(); //(ITextSymbol)Utility.DeepCopy(m_label);
+ uc = new FontStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId);
+ ((FontStyleEditor)uc).Item = m_label == null ? null : (ITextSymbol)m_label.Clone(); //(ITextSymbol)Utility.DeepCopy(m_label);
}
else if (isW2dSymbol)
{
- uc = new PointFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, m_w2dsymbol, _parentRange, _themeCategory, m_point);
- //((PointFeatureStyleEditor)uc).Item = m_point == null ? null : (IPointSymbolization2D)m_point.Clone(); //(IPointSymbolization2D)Utility.XmlDeepCopy(m_point);
+ uc = new PointFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, m_w2dsymbol);
+ ((PointFeatureStyleEditor)uc).Item = m_point == null ? null : (IPointSymbolization2D)m_point.Clone(); //(IPointSymbolization2D)Utility.XmlDeepCopy(m_point);
}
else if (isPoint)
{
- uc = new PointFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, _parentRange, _themeCategory, m_point);
- //((PointFeatureStyleEditor)uc).Item = m_point == null ? null : (IPointSymbolization2D)m_point.Clone(); //(IPointSymbolization2D)Utility.XmlDeepCopy(m_point);
+ uc = new PointFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId);
+ ((PointFeatureStyleEditor)uc).Item = m_point == null ? null : (IPointSymbolization2D)m_point.Clone(); //(IPointSymbolization2D)Utility.XmlDeepCopy(m_point);
}
else if (isLine)
{
- uc = new LineFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, _factory, _parentRange, _themeCategory, m_line);
- //((LineFeatureStyleEditor)uc).Item = m_line == null ? null : LayerElementCloningUtil.CloneStrokes(m_line);//(IList<IStroke>)Utility.XmlDeepCopy(m_line);
+ uc = new LineFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, _factory);
+ ((LineFeatureStyleEditor)uc).Item = m_line == null ? null : LayerElementCloningUtil.CloneStrokes(m_line);//(IList<IStroke>)Utility.XmlDeepCopy(m_line);
}
else if (isArea)
{
- uc = new AreaFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId, _parentRange, _themeCategory, m_area);
- //((AreaFeatureStyleEditor)uc).Item = m_area == null ? null : (IAreaSymbolizationFill)m_area.Clone(); //(IAreaSymbolizationFill)Utility.XmlDeepCopy(m_area);
+ uc = new AreaFeatureStyleEditor(m_owner.Editor, m_owner.SelectedClass, m_owner.FeatureSourceId);
+ ((AreaFeatureStyleEditor)uc).Item = m_area == null ? null : (IAreaSymbolizationFill)m_area.Clone(); //(IAreaSymbolizationFill)Utility.XmlDeepCopy(m_area);
}
else if (isComp)
{
@@ -250,15 +198,12 @@
if (uc != null)
{
- uc.CreateSnapshot();
-
EditorTemplateForm dlg = new EditorTemplateForm();
- dlg.ItemPanel.Controls.Add(uc.Content);
- uc.Content.Dock = DockStyle.Fill;
+ dlg.ItemPanel.Controls.Add(uc);
+ uc.Dock = DockStyle.Fill;
dlg.RefreshSize();
if (dlg.ShowDialog(this) == DialogResult.OK)
{
- /*
if (isLabel)
{
m_label = ((FontStyleEditor)uc).Item;
@@ -301,14 +246,10 @@
if (ItemChanged != null)
ItemChanged(m_area, null);
}
- */
+
this.Refresh();
- Owner.FlagDirty();
+
}
- else
- {
- uc.RejectChanges();
- }
}
}
@@ -327,33 +268,4 @@
EditButton_Click(sender, e);
}
}
-
- internal interface IFeatureStyleEditor
- {
- void RejectChanges();
- void CreateSnapshot();
- Control Content { get; }
- void Detach();
- void Attach();
- bool IsAttached { get; }
- event EventHandler StyleDetached;
- event EventHandler StyleAttached;
- }
-
- public class StylePreview
- {
- /// <summary>
- /// Indicates whether to use client-side rendering to generate style previews. Client-side rendering is more efficient, but does
- /// not produce fully accurate preview styles. Setting it to false will use the GETLEGENDIMAGE API to produce the style preview which
- /// will produce the exact preview style.
- ///
- /// For style-intensive layers, the GETLEGENDIMAGE approach can momentarily grind the MapGuide Server
- /// </summary>
- public static bool UseClientSideStylePreview;
-
- static StylePreview()
- {
- UseClientSideStylePreview = true;
- }
- }
}
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/AreaFeatureStyleEditor.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -27,9 +27,6 @@
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.MaestroAPI.Schema;
-using OSGeo.MapGuide.MaestroAPI.Services;
-using Maestro.Editors.LayerDefinition.Vector.Scales;
-using System.Diagnostics;
namespace Maestro.Editors.LayerDefinition.Vector.StyleEditors
{
@@ -37,7 +34,7 @@
/// Summary description for AreaFeatureStyleEditor.
/// </summary>
[ToolboxItem(false)]
- internal class AreaFeatureStyleEditor : System.Windows.Forms.UserControl, IFeatureStyleEditor
+ internal class AreaFeatureStyleEditor : System.Windows.Forms.UserControl
{
private System.Windows.Forms.ComboBox sizeContextCombo;
private System.Windows.Forms.Label label4;
@@ -74,23 +71,18 @@
private string m_featureSource;
private string m_providername;
private ILayerElementFactory _factory;
- private IVectorScaleRange _parentRange;
- private int _themeCategory;
- public AreaFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, IVectorScaleRange parentRange, int themeCategory, IAreaSymbolizationFill originalItem)
+ public AreaFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource)
: this()
{
m_editor = editor;
m_schema = schema;
- _parentRange = parentRange;
- _themeCategory = themeCategory;
_factory = (ILayerElementFactory)editor.GetEditedResource();
var fs = (IFeatureSource)m_editor.ResourceService.GetResource(featureSource);
m_providername = fs.Provider;
m_featureSource = featureSource;
- m_item = originalItem;
}
private AreaFeatureStyleEditor()
@@ -361,46 +353,19 @@
}
}
- private IMappingService _mapSvc;
-
- IMappingService GetMappingService()
- {
- if (null == _mapSvc)
- {
- var conn = m_editor.GetEditedResource().CurrentConnection;
- if (Array.IndexOf<int>(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
- _mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
- }
- return _mapSvc;
- }
-
- int GetGeomType()
- {
- return 3;
- }
-
private void previewPicture_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
- IMappingService mapSvc = GetMappingService();
- if (mapSvc != null && _parentRange != null && !StylePreview.UseClientSideStylePreview)
- {
- double scale = 10000.0;
- if (_parentRange.MaxScale.HasValue)
- scale = _parentRange.MaxScale.Value - 1.0;
- else if (_parentRange.MinScale.HasValue)
- scale = _parentRange.MinScale.Value + 1.0;
+ FeaturePreviewRender.RenderPreviewArea(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 4, previewPicture.Height - 4), m_item);
+ }
- //Ensure the layer def we're rendering from is latest
- m_editor.SyncSessionCopy();
- using (var img = mapSvc.GetLegendImage(scale, m_editor.GetEditedResource().ResourceID, _themeCategory, GetGeomType(), previewPicture.Width, previewPicture.Height, "PNG"))
- {
- e.Graphics.DrawImage(img, new Point(0, 0));
- }
- }
- else
- {
- FeaturePreviewRender.RenderPreviewArea(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 4, previewPicture.Height - 4), m_item);
- }
+ public IAreaSymbolizationFill Item
+ {
+ get { return m_item; }
+ set
+ {
+ m_item = value;
+ UpdateDisplay();
+ }
}
private void fillCombo_SelectedIndexChanged(object sender, EventArgs e)
@@ -589,54 +554,5 @@
if (expr != null)
fillStyleEditor.foregroundColor.ColorExpression = expr;
}
-
- public void RejectChanges()
- {
- if (m_snapshot != null)
- {
- m_item.Fill = m_snapshot.Fill;
- m_item.Stroke = m_snapshot.Stroke;
- Trace.TraceInformation("AreaFeatureStyleEditor: Changes rejected");
- }
- }
-
- private IAreaSymbolizationFill m_snapshot;
-
- public void CreateSnapshot()
- {
- if (m_item != null)
- {
- m_snapshot = m_item.Clone();
- Trace.TraceInformation("AreaFeatureStyleEditor: Style snapshot created");
- }
- UpdateDisplay();
- }
-
- public Control Content
- {
- get { return this; }
- }
-
- public void Detach()
- {
- this.IsAttached = false;
- var handler = this.StyleDetached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public void Attach()
- {
- this.IsAttached = true;
- var handler = this.StyleAttached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public bool IsAttached { get; private set; }
-
- public event EventHandler StyleDetached;
-
- public event EventHandler StyleAttached;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/FontStyleEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/FontStyleEditor.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/FontStyleEditor.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -28,8 +28,6 @@
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.MaestroAPI.Schema;
-using Maestro.Editors.LayerDefinition.Vector.Scales;
-using System.Diagnostics;
namespace Maestro.Editors.LayerDefinition.Vector.StyleEditors
{
@@ -37,7 +35,7 @@
/// Summary description for FontStyleEditor.
/// </summary>
[ToolboxItem(false)]
- internal class FontStyleEditor : System.Windows.Forms.UserControl, IFeatureStyleEditor
+ internal class FontStyleEditor : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
@@ -111,7 +109,7 @@
private ILayerElementFactory _factory;
- public FontStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, ITextSymbol originalItem)
+ public FontStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource)
: this()
{
m_editor = editor;
@@ -136,7 +134,6 @@
foreach (FontFamily f in new System.Drawing.Text.InstalledFontCollection().Families)
fontCombo.Items.Add(f.Name);
- m_item = originalItem;
}
private FontStyleEditor()
@@ -929,6 +926,16 @@
Changed(this, new EventArgs());
}
+ public ITextSymbol Item
+ {
+ get { return m_item; }
+ set
+ {
+ m_item = value;
+ UpdateDisplay();
+ }
+ }
+
private void DisplayLabel_CheckedChanged(object sender, EventArgs e)
{
foreach (Control c in this.Controls)
@@ -938,11 +945,6 @@
return;
if (DisplayLabel.Checked)
- Attach();
- else
- Detach();
- /*
- if (DisplayLabel.Checked)
{
if (DisplayLabel.Tag as ITextSymbol != null)
this.Item = DisplayLabel.Tag as ITextSymbol;
@@ -953,7 +955,8 @@
{
DisplayLabel.Tag = m_item;
this.Item = null;
- }*/
+ }
+
}
private void sizeCombo_TextChanged(object sender, EventArgs e)
@@ -1035,73 +1038,5 @@
Changed(this, new EventArgs());
}
-
- public void RejectChanges()
- {
- if (m_snapshot != null)
- {
- m_item.AdvancedPlacement = m_snapshot.AdvancedPlacement;
- m_item.BackgroundColor = m_snapshot.BackgroundColor;
- m_item.BackgroundStyle = m_snapshot.BackgroundStyle;
- m_item.Bold = m_snapshot.Bold;
- m_item.FontName = m_snapshot.FontName;
- m_item.ForegroundColor = m_snapshot.ForegroundColor;
- m_item.HorizontalAlignment = m_snapshot.HorizontalAlignment;
- m_item.InsertionPointX = m_snapshot.InsertionPointX;
- m_item.InsertionPointY = m_snapshot.InsertionPointY;
- m_item.Italic = m_snapshot.Italic;
- m_item.MaintainAspect = m_snapshot.MaintainAspect;
- m_item.Rotation = m_snapshot.Rotation;
- m_item.SizeContext = m_snapshot.SizeContext;
- m_item.SizeX = m_snapshot.SizeX;
- m_item.SizeY = m_snapshot.SizeY;
- m_item.Text = m_snapshot.Text;
- //m_item.Type = m_snapshot.Type;
- m_item.Underlined = m_snapshot.Underlined;
- m_item.Unit = m_snapshot.Unit;
- m_item.VerticalAlignment = m_snapshot.VerticalAlignment;
-
- Trace.TraceInformation("FontStyleEditor: Changes rejected");
- }
- }
-
- private ITextSymbol m_snapshot;
-
- public void CreateSnapshot()
- {
- if (m_item != null)
- {
- m_snapshot = m_item.Clone();
- Trace.TraceInformation("FontStyleEditor: Style snapshot created");
- }
- UpdateDisplay();
- }
-
- public Control Content
- {
- get { return this; }
- }
-
- public void Detach()
- {
- this.IsAttached = false;
- var handler = this.StyleDetached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public void Attach()
- {
- this.IsAttached = true;
- var handler = this.StyleAttached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public bool IsAttached { get; private set; }
-
- public event EventHandler StyleDetached;
-
- public event EventHandler StyleAttached;
- }
+ }
}
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -29,9 +29,6 @@
using Maestro.Editors.Common;
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.MaestroAPI.Schema;
-using OSGeo.MapGuide.MaestroAPI.Services;
-using Maestro.Editors.LayerDefinition.Vector.Scales;
-using System.Diagnostics;
namespace Maestro.Editors.LayerDefinition.Vector.StyleEditors
{
@@ -39,7 +36,7 @@
/// Summary description for LineFeatureStyleEditor.
/// </summary>
[ToolboxItem(false)]
- internal class LineFeatureStyleEditor : System.Windows.Forms.UserControl, IFeatureStyleEditor
+ internal class LineFeatureStyleEditor : System.Windows.Forms.UserControl
{
/// <summary>
/// Required designer variable.
@@ -82,16 +79,12 @@
private string m_featureSource;
private string m_providername;
private ILayerElementFactory _factory;
- private IVectorScaleRange _parentRange;
- private int _themeCategory;
- public LineFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, ILayerElementFactory factory, IVectorScaleRange parentRange, int themeCategory, IList<IStroke> originalItem)
+ public LineFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, ILayerElementFactory factory)
: this()
{
m_editor = editor;
m_schema = schema;
- _parentRange = parentRange;
- _themeCategory = themeCategory;
_factory = (ILayerElementFactory)editor.GetEditedResource();
@@ -99,7 +92,6 @@
m_providername = fs.Provider;
m_featureSource = featureSource;
- m_item = originalItem;
}
private LineFeatureStyleEditor()
@@ -520,6 +512,16 @@
Changed(this, new EventArgs());
}
+ public IList<IStroke> Item
+ {
+ get { return m_item; }
+ set
+ {
+ m_item = value;
+ UpdateDisplay();
+ }
+ }
+
private void thicknessCombo_TextChanged(object sender, EventArgs e)
{
if (m_inUpdate || lineStyleEditor.thicknessCombo.SelectedIndex != -1)
@@ -584,7 +586,6 @@
if (!applyLineStyle.Checked)
{
applyLineStyle.Tag = m_item;
- //TODO: Need to review this given the accept/reject pattern changes
m_item = new BindingList<IStroke>();
}
else
@@ -617,46 +618,9 @@
Changed(this, new EventArgs());
}
- private IMappingService _mapSvc;
-
- IMappingService GetMappingService()
- {
- if (null == _mapSvc)
- {
- var conn = m_editor.GetEditedResource().CurrentConnection;
- if (Array.IndexOf<int>(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
- _mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
- }
- return _mapSvc;
- }
-
- int GetGeomType()
- {
- return 1;
- }
-
private void previewPicture_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
- var mapSvc = GetMappingService();
- if (mapSvc != null && _parentRange != null && !StylePreview.UseClientSideStylePreview)
- {
- double scale = 10000.0;
- if (_parentRange.MaxScale.HasValue)
- scale = _parentRange.MaxScale.Value - 1.0;
- else if (_parentRange.MinScale.HasValue)
- scale = _parentRange.MinScale.Value + 1.0;
-
- //Ensure the layer def we're rendering from is latest
- m_editor.SyncSessionCopy();
- using (var img = mapSvc.GetLegendImage(scale, m_editor.GetEditedResource().ResourceID, _themeCategory, GetGeomType(), previewPicture.Width, previewPicture.Height, "PNG"))
- {
- e.Graphics.DrawImage(img, new Point(0, 0));
- }
- }
- else
- {
- FeaturePreviewRender.RenderPreviewLine(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), m_item);
- }
+ FeaturePreviewRender.RenderPreviewLine(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), m_item);
}
private void lineStyles_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
@@ -729,56 +693,5 @@
if (expr != null)
lineStyleEditor.ColorExpression = expr;
}
-
- public void RejectChanges()
- {
- if (m_snapshot != null)
- {
- m_item.Clear();
- foreach (IStroke st in m_snapshot)
- m_item.Add(st);
-
- Trace.TraceInformation("LineFeatureStyleEditor: Changes rejected");
- }
- }
-
- private IList<IStroke> m_snapshot;
-
- public void CreateSnapshot()
- {
- if (m_item != null)
- {
- m_snapshot = LayerElementCloningUtil.CloneStrokes(m_item);
- Trace.TraceInformation("LineFeatureStyleEditor: Style snapshot created");
- }
- UpdateDisplay();
- }
-
- public Control Content
- {
- get { return this; }
- }
-
- public void Detach()
- {
- this.IsAttached = false;
- var handler = this.StyleDetached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public void Attach()
- {
- this.IsAttached = true;
- var handler = this.StyleAttached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public bool IsAttached { get; private set; }
-
- public event EventHandler StyleDetached;
-
- public event EventHandler StyleAttached;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/PointFeatureStyleEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/PointFeatureStyleEditor.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/PointFeatureStyleEditor.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -31,9 +31,6 @@
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
-using OSGeo.MapGuide.MaestroAPI.Services;
-using Maestro.Editors.LayerDefinition.Vector.Scales;
-using System.Diagnostics;
namespace Maestro.Editors.LayerDefinition.Vector.StyleEditors
{
@@ -41,7 +38,7 @@
/// Summary description for PointFeatureStyleEditor.
/// </summary>
[ToolboxItem(false)]
- internal class PointFeatureStyleEditor : System.Windows.Forms.UserControl, IFeatureStyleEditor
+ internal class PointFeatureStyleEditor : System.Windows.Forms.UserControl
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
@@ -124,16 +121,12 @@
private CheckBox chkW2DFillColor;
private ColorComboWithTransparency cmbW2DFillColor;
private ILayerElementFactory _factory;
- private IVectorScaleRange _parentRange;
- private int _themeCategory;
- public PointFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, IVectorScaleRange parentRange, int themeCategory, IPointSymbolization2D originalItem)
+ public PointFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource)
: this()
{
m_editor = editor;
m_schema = schema;
- _parentRange = parentRange;
- _themeCategory = themeCategory;
_factory = (ILayerElementFactory)editor.GetEditedResource();
var fs = (IFeatureSource)editor.ResourceService.GetResource(featureSource);
@@ -141,11 +134,11 @@
m_providername = fs.Provider;
m_featureSource = featureSource;
- m_item = originalItem;
+ m_item = _factory.CreateDefaultPointSymbolization2D();
}
- public PointFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, Image currentW2D, IVectorScaleRange parentRange, int themeCategory, IPointSymbolization2D originalItem)
- : this(editor, schema, featureSource, parentRange, themeCategory, originalItem)
+ public PointFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, Image currentW2D)
+ : this(editor, schema, featureSource)
{
grpW2DStyle.Tag = currentW2D;
}
@@ -896,54 +889,17 @@
UpdateDisplay();
}
- private IMappingService _mapSvc;
-
- IMappingService GetMappingService()
- {
- if (null == _mapSvc)
- {
- var conn = m_editor.GetEditedResource().CurrentConnection;
- if (Array.IndexOf<int>(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
- _mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
- }
- return _mapSvc;
- }
-
- int GetGeomType()
- {
- return 1;
- }
-
private void previewPicture_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
- IMappingService mapSvc = GetMappingService();
- if (mapSvc != null && _parentRange != null && !StylePreview.UseClientSideStylePreview)
- {
- double scale = 10000.0;
- if (_parentRange.MaxScale.HasValue)
- scale = _parentRange.MaxScale.Value - 1.0;
- else if (_parentRange.MinScale.HasValue)
- scale = _parentRange.MinScale.Value + 1.0;
-
- //Ensure the layer def we're rendering from is latest
- m_editor.SyncSessionCopy();
- using (var img = mapSvc.GetLegendImage(scale, m_editor.GetEditedResource().ResourceID, _themeCategory, GetGeomType(), previewPicture.Width, previewPicture.Height, "PNG"))
- {
- e.Graphics.DrawImage(img, new Point(0, 0));
- }
- }
+ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
+ if (m_item != null && m_item.Symbol.Type == PointSymbolType.Mark)
+ FeaturePreviewRender.RenderPreviewPoint(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), (IMarkSymbol)m_item.Symbol);
+ else if (m_item != null && m_item.Symbol.Type == PointSymbolType.Font)
+ FeaturePreviewRender.RenderPreviewFontSymbol(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), (IFontSymbol)m_item.Symbol);
+ else if (m_item != null && m_item.Symbol.Type == PointSymbolType.W2D)
+ FeaturePreviewRender.RenderW2DImage(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), (IW2DSymbol)m_item.Symbol, grpW2DStyle.Tag as Image);
else
- {
- e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
- if (m_item != null && m_item.Symbol.Type == PointSymbolType.Mark)
- FeaturePreviewRender.RenderPreviewPoint(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), (IMarkSymbol)m_item.Symbol);
- else if (m_item != null && m_item.Symbol.Type == PointSymbolType.Font)
- FeaturePreviewRender.RenderPreviewFontSymbol(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), (IFontSymbol)m_item.Symbol);
- else if (m_item != null && m_item.Symbol.Type == PointSymbolType.W2D)
- FeaturePreviewRender.RenderW2DImage(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), (IW2DSymbol)m_item.Symbol, grpW2DStyle.Tag as Image);
- else
- FeaturePreviewRender.RenderPreviewPoint(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), null);
- }
+ FeaturePreviewRender.RenderPreviewPoint(e.Graphics, new Rectangle(1, 1, previewPicture.Width - 2, previewPicture.Height - 2), null);
}
private IW2DSymbol m_lastSymbol;
@@ -1420,6 +1376,17 @@
comboBoxCharacter_SelectedIndexChanged(sender, e);
}
+
+ public IPointSymbolization2D Item
+ {
+ get { return m_item; }
+ set
+ {
+ m_item = value;
+ UpdateDisplay();
+ }
+ }
+
private void DisplayPoints_CheckedChanged(object sender, EventArgs e)
{
foreach (Control c in this.Controls)
@@ -1429,11 +1396,6 @@
return;
if (DisplayPoints.Checked)
- Attach();
- else
- Detach();
- /*
- if (DisplayPoints.Checked)
{
if (DisplayPoints.Tag as IPointSymbolization2D != null)
this.Item = DisplayPoints.Tag as IPointSymbolization2D;
@@ -1444,7 +1406,7 @@
{
DisplayPoints.Tag = m_item;
this.Item = null;
- }*/
+ }
}
static string DoubleToString(double? value)
@@ -1695,53 +1657,5 @@
if (Changed != null)
Changed(this, new EventArgs());
}
-
- public void RejectChanges()
- {
- if (m_snapshot != null)
- {
- m_item.Symbol = m_snapshot.Symbol;
- Trace.TraceInformation("PointFeatureStyleEditor: Changes rejected");
- }
- }
-
- private IPointSymbolization2D m_snapshot;
-
- public void CreateSnapshot()
- {
- if (m_item != null)
- {
- m_snapshot = m_item.Clone();
- Trace.TraceInformation("PointFeatureStyleEditor: Style snapshot created");
- }
- UpdateDisplay();
- }
-
- public Control Content
- {
- get { return this; }
- }
-
- public void Detach()
- {
- this.IsAttached = false;
- var handler = this.StyleDetached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public void Attach()
- {
- this.IsAttached = true;
- var handler = this.StyleAttached;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
-
- public bool IsAttached { get; private set; }
-
- public event EventHandler StyleDetached;
-
- public event EventHandler StyleAttached;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs 2011-11-30 08:07:17 UTC (rev 6265)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs 2011-11-30 11:16:15 UTC (rev 6266)
@@ -820,45 +820,42 @@
private void ChangeBaseStyleBtn_Click(object sender, EventArgs e)
{
IVectorLayerDefinition vl = (IVectorLayerDefinition)m_layer.SubLayer;
- IFeatureStyleEditor uc = null;
+ UserControl uc = null;
if (m_ruleCollection is IPointVectorStyle)
{
- uc = new PointFeatureStyleEditor(m_editor, m_schema, vl.ResourceId, null, -1, (IPointSymbolization2D)m_defaultItem);
- //((PointFeatureStyleEditor)uc).Item = (IPointSymbolization2D)Utility.XmlDeepCopy(m_defaultItem);
+ uc = new PointFeatureStyleEditor(m_editor, m_schema, vl.ResourceId);
+ ((PointFeatureStyleEditor)uc).Item = (IPointSymbolization2D)Utility.XmlDeepCopy(m_defaultItem);
((PointFeatureStyleEditor)uc).SetupForTheming();
}
else if (m_ruleCollection is ILineVectorStyle)
{
+ uc = new LineFeatureStyleEditor(m_editor, m_schema, vl.ResourceId, _factory);
var rule = _factory.CreateDefaultLineRule();
- uc = new LineFeatureStyleEditor(m_editor, m_schema, vl.ResourceId, _factory, null, -1, new List<IStroke>(rule.Strokes));
- //((LineFeatureStyleEditor)uc).Item = new List<IStroke>(rule.Strokes);
+ ((LineFeatureStyleEditor)uc).Item = new List<IStroke>(rule.Strokes);
((LineFeatureStyleEditor)uc).SetupForTheming();
}
else if (m_ruleCollection is IAreaVectorStyle)
{
- uc = new AreaFeatureStyleEditor(m_editor, m_schema, vl.ResourceId, null, -1, (IAreaSymbolizationFill)m_defaultItem);
- //((AreaFeatureStyleEditor)uc).Item = (IAreaSymbolizationFill)Utility.XmlDeepCopy(m_defaultItem);
+ uc = new AreaFeatureStyleEditor(m_editor, m_schema, vl.ResourceId);
+ ((AreaFeatureStyleEditor)uc).Item = (IAreaSymbolizationFill)Utility.XmlDeepCopy(m_defaultItem);
((AreaFeatureStyleEditor)uc).SetupForTheming();
}
if (uc != null)
{
EditorTemplateForm dlg = new EditorTemplateForm();
- dlg.ItemPanel.Controls.Add(uc.Content);
- uc.Content.Dock = DockStyle.Fill;
+ dlg.ItemPanel.Controls.Add(uc);
+ uc.Dock = DockStyle.Fill;
dlg.RefreshSize();
- if (dlg.ShowDialog(this) != DialogResult.OK)
+ if (dlg.ShowDialog(this) == DialogResult.OK)
{
- uc.RejectChanges();
- /*
if (m_ruleCollection is IPointVectorStyle)
m_defaultItem = ((PointFeatureStyleEditor)uc).Item;
else if (m_ruleCollection is ILineVectorStyle)
m_defaultItem = ((LineFeatureStyleEditor)uc).Item;
else if (m_ruleCollection is IAreaVectorStyle)
m_defaultItem = ((AreaFeatureStyleEditor)uc).Item;
- */
}
}
More information about the mapguide-commits
mailing list