Lengend Tool little bugs ?

Developer
Dec 16, 2010 at 12:24 PM

If in the demomap I invoke properties on a shapefile (rigth click then properties on a polygon layer in my case)  the program crashes here

public class DetailedLineSymbolControl : UserControl

in initializeComponent at the line:

            this.dashControl1.HorizontalSlider.Position = ((System.Drawing.PointF)(resources.GetObject("resource.Position")));

with a null reference exception.

I make something wrong ?

 

 

then if I save a Map.xml file with unchecked layer(s) ( not visible layer(s) ) then I reopend the project they are always checked as visible.ù

May be this is what you want but in my opinion if I save an unchecked layer when I open the project he must be unchecked.

 

Thanks a lot !

 

 

<script id="gtbTranslateElementCode">// <![CDATA[var gtbTranslateOnElementLoaded;(function(){var lib = null;var checkReadyCount = 0;function sendMessage(message, attrs) { var data = document.getElementById("gtbTranslateElementCode"); for (var p in attrs) { data.removeAttribute(p); } for (var p in attrs) { if ("undefined" != typeof attrs[p]) { data.setAttribute(p, attrs[p]); } } var evt = document.createEvent("Events"); evt.initEvent(message, true, false); document.dispatchEvent(evt);}function checkLibReady (){ var ready = lib.isAvailable(); if (ready) { sendMessage("gtbTranslateLibReady", {"gtbTranslateError" : false}); return; } if (checkReadyCount++ > 5) { sendMessage("gtbTranslateLibReady", {"gtbTranslateError" : true}); return; } setTimeout(checkLibReady, 100);}gtbTranslateOnElementLoaded = function () { lib = google.translate.TranslateService({}); sendMessage("{EVT_LOADED}", {}, []); var data = document.getElementById("gtbTranslateElementCode"); data.addEventListener("gtbTranslate", onTranslateRequest, true); data.addEventListener("gtbTranslateCheckReady", onCheckReady, true); data.addEventListener("gtbTranslateRevert", onRevert, true); checkLibReady();};function onCheckReady() { var ready = lib.isAvailable(); sendMessage("gtbTranslateLibReady", {"gtbTranslateError" : !ready});}function onTranslateRequest() { var data = document.getElementById("gtbTranslateElementCode"); var orig = data.getAttribute("gtbOriginalLang"); var target = data.getAttribute("gtbTargetLang"); lib.translatePage(orig, target, onProgress);}function onProgress(progress, opt_finished, opt_error) { sendMessage("gtbTranslateOnProgress", {"gtbTranslateProgress" : progress, "gtbTranslateFinished" : opt_finished, "gtbTranslateError" : opt_error});}function onRevert() { lib.restore();}})(); (function(){var d=window,e=document;function f(b){var a=e.getElementsByTagName("head")[0];a||(a=e.body.parentNode.appendChild(e.createElement("head")));a.appendChild(b)}function _loadJs(b){var a=e.createElement("script");a.type="text/javascript";a.charset="UTF-8";a.src=b;f(a)}function _loadCss(b){var a=e.createElement("link");a.type="text/css";a.rel="stylesheet";a.charset="UTF-8";a.href=b;f(a)}function _isNS(b){b=b.split(".");for(var a=d,c=0;c</script>
Developer
Dec 16, 2010 at 3:18 PM

In the first case I have been having loads of problems with the "localization" settings that allow these classes to switch to different languages eventually.  In practice, I think we only have english and a little Chinese in there.  The issue is that even your physical layout may need to change to accommodate languages with different string lengths.  In practice, almost none of the dimensionality properties need to be in the resource file at all, but the designer tries to put things there.  The usual problem is a conflict between the 4.0 and 3.5 framework serialization models.  In this case, I would suspect that either the resource is missing from the resource file, or its there and can't be converted into ta PointF.  You might be able to fix this by deleting that line entirely.  If you remove the line, it may result in a misaligned slider, or it may do nothing at all.  If it fixes the bug we would love for you to be able to commit the fix on this.

 

As to your second comment, I agree.  I am at work and can't fix this now.  However, if you want to take a crack at it, here is what you should do.  Find the LegendItem class in DotSpatial.Symbology.  Browse through that class until you find the "Visible" property.  This is where the boolean value is cached.  Above that property, add the [Serialize("Visible")] tag.  This will include the visible status in the XML file the next time you serialize and deserialize.  Since this wasn't being serialized before, your old maps still won't work, but any new maps you create will work.

Developer
Jan 18, 2011 at 9:56 PM

Removing the following lines in DetailedLineSymbolControl.cs as Ted suggested fixes the null reference exceptions .

this.dashControl1.HorizontalSlider.Position = ((System.Drawing.PointF)(resources.GetObject("resource.Position")));

this.dashControl1.VerticalSlider.Position = ((System.Drawing.PointF)(resources.GetObject("resource.Position1")));

The slider looks fine.

Developer
Jan 18, 2011 at 10:51 PM
kurtw555 wrote:

Removing the following lines in DetailedLineSymbolControl.cs as Ted suggested fixes the null reference exceptions .

this.dashControl1.HorizontalSlider.Position = ((System.Drawing.PointF)(resources.GetObject("resource.Position")));

this.dashControl1.VerticalSlider.Position = ((System.Drawing.PointF)(resources.GetObject("resource.Position1")));

The slider looks fine.

 

Ted was right about the resource missing from the resource file. We fixed that last Friday so you shouldn't have any trouble if you are using a recent source build.

See issue http://dotspatial.codeplex.com/workitem/195