www.sdlsuite.com Forum Index www.sdlsuite.com
Discussion of technical aspects of the SDL Component Suite
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Landmark Identifier doesn't seem to be saved

 
Post new topic   Reply to topic    www.sdlsuite.com Forum Index -> GeoPack
View previous topic :: View next topic  
Author Message
captnkrunch



Joined: 27 Mar 2007
Posts: 19

PostPosted: Sat Apr 30, 2011 8:55 pm    Post subject: Landmark Identifier doesn't seem to be saved Reply with quote

I have strong reason to believe that the IDentifier string is not being properly written to the XML landmark data file. In fact, an examination of the saved landmarks xml file appears to have an ID for the set of landmarks rather than for each individually.

Everything works pretty well until the landmarks are saved then reloaded.

Does anyone agree with this observation?
Back to top
View user's profile Send private message
hlohning



Joined: 08 Sep 2006
Posts: 277
Location: Austria

PostPosted: Wed May 04, 2011 3:24 pm    Post subject: Reply with quote

You are absolutely right - that's a bug. I've added it to the bugtracking list:

http://www.lohninger.com/bugtracking.html

If you have the sources, you can help yourself by modifying the writeln statement in the "WriteLandmarksToOpenXMLFile" procedure (WriteLandmarksToOpenXMLFile is called by SaveLandmarks). Following is the fixed code:

Code:

    writeln (OutFile, '<',xmlTagIds[xmlLandmark],
                      ' lat="',FloatToStr(Latitude),
                      '" long="',FloatToStr(Longitude),
                      '" height="',FloatToStr(Height),
                      '" class="',IntToStr(ClassFlag),
                      '" usertag="',IntToStr(Tag),
                      '" colorfg="',Hex(SymbolProps.FGColor, 8),
                      '" colorbg="',Hex(SymbolProps.BGColor, 8),
                      '" size="',IntToStr(SymbolProps.Size),
                      '" transp="',BoolToStr(SymbolProps.Transparent,0),
                      '" element="',LMTypeNames[SymbolProps.Kind],
                      '" dir="',IntToStr(SymbolProps.Direction),
                      '" leng="',IntToStr(SymbolProps.Length),
                      '" id="',Identifier,
                      '" date="',FormatDateTime('yyyymmddHHMMSS', time),
                      '" />');


Regards,

Hans
_________________
Hans Lohninger
Software Development Lohninger
http://www.lohninger.com/
Back to top
View user's profile Send private message Visit poster's website
captnkrunch



Joined: 27 Mar 2007
Posts: 19

PostPosted: Mon May 09, 2011 6:00 pm    Post subject: Reply with quote

Thank you. I appreciate the help but I do not have the source. I'm willing to try to fake it, however, that leaves the problem of the header structure, the definition of xmlTagIds and Hex ... all of which created compiler errors.

If you could provide the complete loop, including the header generation, I would be grateful. Thanks.
Back to top
View user's profile Send private message
hlohning



Joined: 08 Sep 2006
Posts: 277
Location: Austria

PostPosted: Fri May 13, 2011 8:58 am    Post subject: Reply with quote

OK, here's the entire code of "WriteLandmarksToOpenXMLFile":

Code:

(******************************************************************************)
procedure TGeoMap.WriteLandmarksToOpenXMLFile (var OutFile : TextFile;
                  CreateHeader: boolean; DataID: string);
(******************************************************************************
  ENTRY: OutFile .......... text file to be written (must be already open)
         CreateHeader ... TRUE: simple XML header is created
         DataID ......... data ID

  EXIT:  Landmark data of TGeoMap is exported to the text file OutFile

  Format Example:
            <gmlandmarks sig="SDLCSuite" vers="1.0" id="test">
            <landmark lat="12.3772" long="48.25" class="3" usertag="16"
                    colorfg="#002200" colorbg="#FFEEFF" size="12" transp="FALSE"
                    element="lmCross" dir="180" leng="40" />
            <landmark lat="12.3812" long="47.05" class="3" usertag="0"
                    colorfg="#0000FF" colorbg="#FFFFFF" size="15" transp="FALSE"
                    element="lmArrowTo" dir="45" leng="40" />
            </gmlandmarks>
 ******************************************************************************)


var
  i       : integer;

begin
if CreateHeader then
  writeln (OutFile, '<?xml version="1.0"?>');
writeln (OutFile);
writeln (OutFile, '<!-- TGeoMap Landmarks / SDL Component Suite -->');
writeln (OutFile, '<'+xmlTagIds[xmlLMBegin]+' sig="SDLCSuite" vers="10.0" id="'+DataID+'">');

for i:=1 to FNumLandMarks do
  begin
  with FLandMarks[i-1] do
    begin
    writeln (OutFile, '<',xmlTagIds[xmlLandmark],
                      ' lat="',FloatToStr(Latitude),
                      '" long="',FloatToStr(Longitude),
                      '" height="',FloatToStr(Height),
                      '" class="',IntToStr(ClassFlag),
                      '" usertag="',IntToStr(Tag),
                      '" colorfg="',Hex(SymbolProps.FGColor, 8),
                      '" colorbg="',Hex(SymbolProps.BGColor, 8),
                      '" size="',IntToStr(SymbolProps.Size),
                      '" transp="',BoolToStr(SymbolProps.Transparent,0),
                      '" element="',LMTypeNames[SymbolProps.Kind],
                      '" dir="',IntToStr(SymbolProps.Direction),
                      '" leng="',IntToStr(SymbolProps.Length),
                      '" id="',Identifier,
                      '" date="',FormatDateTime('yyyymmddHHMMSS', time),
                      '" />');
    end;
  end;

writeln (OutFile, '<'+xmlTagIds[xmlLMEnd]+'>');
end;



Further your need to use the following declarations which are not public:

Code:
type
  TGeoXmlTag = (xmlGeoMapBegin, xmlGeoMapEnd, xmlGeoMapCalLine, xmlExtents,
                xmlResolution, xmlLMbegin, xmlLMEnd, xmlLandmark, xmlCalQuads,
                xmlSymbolBegin, xmlSymbolEnd, xmlSymbol, xmlUTMZone, xmlUTMSouth,
                xmlEllipsoid, xmlInvalid);


and

Code:

const
  xmlTagIds : array[xmlGeoMapBegin..xmlInValid] of string =   {xml tag names}
               ('geomap', '/geomap', 'calline', 'corners', 'resolution',
                'gmlandmarks', '/gmlandmarks', 'landmark', 'calquads',
                'lmsymbols', '/lmsymbols', 'symbol', 'utmzone', 'utmsouth',
                'ellipsoid', 'invalidtag');

_________________
Hans Lohninger
Software Development Lohninger
http://www.lohninger.com/
Back to top
View user's profile Send private message Visit poster's website
captnkrunch



Joined: 27 Mar 2007
Posts: 19

PostPosted: Fri May 13, 2011 9:51 pm    Post subject: Reply with quote

you're the best! long live sdlsuite!
Back to top
View user's profile Send private message
captnkrunch



Joined: 27 Mar 2007
Posts: 19

PostPosted: Thu May 19, 2011 7:19 pm    Post subject: Reply with quote

Hmmm. Things are pretty good now but the definition of the HEX function must not be as straightforward as I think. Maybe it should be in BasePack?
In any case, an implementation hint would be helpful.
Back to top
View user's profile Send private message
hlohning



Joined: 08 Sep 2006
Posts: 277
Location: Austria

PostPosted: Fri May 27, 2011 5:39 am    Post subject: Reply with quote

The Hex function is part of the unit SDL_math1.

Regards,

Hans
_________________
Hans Lohninger
Software Development Lohninger
http://www.lohninger.com/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.sdlsuite.com Forum Index -> GeoPack All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group