How can I remove the measure scale on the Ajaxmap?

Topics: SharpMap v0.9 / v1.x, Web Controls
Apr 12, 2008 at 7:43 AM
I tried the ajax sample provided in the "MNorm_Ajax3.0.1.zip"(http://www.codeplex.com/SharpMap/WorkItem/View.aspx?WorkItemId=14165) but I got a problem with the measure tool.

I don't need the measure function so I simply removed the button, but the "5 mi" scale was still there...

I have read the code but still didn't find the statements I need to delete.

Please help me...It's really annoying...

Thanks a lot...
Apr 12, 2008 at 10:03 AM

wnyangyang wrote:
I tried the ajax sample provided in the "MNorm_Ajax3.0.1.zip"(http://www.codeplex.com/SharpMap/WorkItem/View.aspx?WorkItemId=14165) but I got a problem with the measure tool.

I don't need the measure function so I simply removed the button, but the "5 mi" scale was still there...

I have read the code but still didn't find the statements I need to delete.

Please help me...It's really annoying...

Thanks a lot...


You should remove this string in file AjaxMapControl.cs
private HtmlGenericControl divScaleBar;
private HtmlGenericControl divScaleFrame;
private HtmlGenericControl divScaleText;

In method private void GenerateClientScripts() remove this
obj + ".scalebar = WebForm_GetElementById('" + divScaleBar.ClientID + "');" + newline +
obj + ".scaletext = WebForm_GetElementById('" + divScaleText.ClientID + "');" + newline;

In method private void GenerateMapBox() remove this
divScaleBar = new HtmlGenericControl("div");
divScaleBar.ID = "scaleBar";
divScaleBar.Style.Clear();
divScaleBar.Style.Add("position", "relative");
divScaleBar.Style.Add("height", "0.3em");
divScaleBar.Style.Add("width", "12px");
divScaleBar.Style.Add("overflow", "hidden");
divScaleBar.Style.Add("border-bottom", "solid 1px #000");
divScaleBar.Style.Add("border-right", "solid 1px #000");
divScaleBar.Style.Add("border-left", "solid 1px #000");

divScaleText = new HtmlGenericControl("div");
divScaleText.ID = "scaleText";
divScaleText.Style.Clear();
divScaleText.Style.Add("position", "relative");
divScaleText.InnerText = "5 mi";

divScaleFrame = new HtmlGenericControl("div");
divScaleFrame.ID = "scaleFrame";
divScaleFrame.Style.Clear();
divScaleFrame.Style.Add("position", "absolute");
divScaleFrame.Style.Add("text-align", "center");
divScaleFrame.Style.Add("background-color", "#fff");
divScaleFrame.Style.Add("opacity ", "0.7");
divScaleFrame.Style.Add("filter", "ALPHA(opacity=70)");
divScaleFrame.Style.Add("Z-index", "21");
divScaleFrame.Style.Add("padding", "0.3em");
divScaleFrame.Style.Add("left", "60%");
divScaleFrame.Style.Add("top", "95%");
divScaleFrame.Controls.Add(divScaleBar);
divScaleFrame.Controls.Add(divScaleText);
this.Controls.Add(divScaleFrame);

And in file AjaxMap.js
You should remove method function SharpMap_RedrawScaleBar(obj)

And in method function SharpMap_DynamicZoom(tox,toy,toscale,step,obj)
remove this SharpMap_RedrawScaleBar(obj);

That's all.
Also I have added load indication. If you want to get it, send me e-mail to vlasovsv at gmail.com.
Dec 2, 2008 at 3:27 AM
I have just started using SharpMap with ajax map control. Im try'g do few things like using Load indication, adding point one by one like a tracking on the map. I hope you should be able to help me in this regard.
arun