logo separator

[mkgmap-dev] gmapi reader?

From Gerd Petermann gpetermann_muenchen at hotmail.com on Mon Jan 29 12:06:55 GMT 2018

Hi Steve,

I'd like to merge first and do any optimisation later.

I've done a few tests reg. memory. I think we should not care much. It would be easy to free the resources
allocated in DEMTile directly after the data was written. I think peak memory is reached when
processing the style, not at this stage.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve at parabola.me.uk>
Gesendet: Montag, 29. Januar 2018 12:30
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] gmapi reader?


Hi Gerd

Is this something that needs to be done before the merge?

> the DEM header structures are quite special, the headers of the sections are written at the very end of the DEM file,
> and they point to data that follows the main header. This is probably not mandantory but it's the way Garmin does it,
> and also DemDisplay uses it to determine the length of the last bitstream.
> So, to do the needed checks we have to read main header and the DEM Section headers at the end of the file.

OK so that is more than I thought, but still not the whole file?  If
you do have to read the whole file, then you might as well use it and
the following may not make sense.

> Not sure where to place this if not in DEMFile. Where would you implement that?

I meant to move everything in DEMFile.tryCopy().

I guess it goes back to Map.addDem().  If possible you want to do
things there or in the code that calls addDem().

You may not have all the required information there, in which case I
don't know
how to proceed.

Currently addDem() is:

        demFile = new DEMFile(fileSystem.create(mapId + ".DEM"), true);

But you want either a DEMFile or a FileCopier,
you only want the demFile when you need to create it.

        handle = fileSystem.create(mapId + ".DEM");

        if (checkExistingDem()) {
                // Can copy existing one

                // Just a rough idea, many details to be filled in...
                fc = FileCopier(fileContainingDem);
                cl = fc.add(demFilename, handle)
                handle.link(() -> demSize, cl);

                // Probably would create a new constructor:
                // fc = FileCopier(handle, fileContainingDem);
                // fc.add(demFilename);
                // When the img file is closed then the copy will happen
                // automatically.

                // demFile = null
        } else {
                // Need to create it
                demFile = new DEMFile(handle, true);
        }

Hope that makes some kind of sense.
There are probably a lot of details missing.

> reg. FileCopier: I don't see how I can use that class outside of GmapsuppBuilder. Maybe you can extract it?
>
> I've already thought about using FileBackedImgWriter. I'll do some tests to find out how it influences performance.

Yes it will need to be moved to a top level class and maybe some
changes as well.

..Steve
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list