Giter Club home page Giter Club logo

Comments (6)

Karry avatar Karry commented on June 3, 2024 1

I am missing routeWay->SetFeatures(features); in your snippet

from libosmscout.

Framstag avatar Framstag commented on June 3, 2024

Strange:

In the standard configuration (standard.oss) in include/route.oss you can find:

OSS

CONST
  COLOR routeColor = #ff000088;

STYLE
  [MAG world-] {
    [TYPE _route] WAY {color: @routeColor; displayWidth: 1.5mm; width: 6m; priority: 100; }
  }

END

Important in context is the priority: 100. This sets WayData.priority. See also OSS.atg/WAYGROUP where WayData.wayPriority is set.

See also MapPainter::WayData::operator<which orders the way. Ways are rendered in the resulting order.

Which should result in the route being the last entry in the way render list, thus rendering on top of everything else. Looking at the code however, it seems like the way needs to have a "high" layer value for this, too, to be rendered after "lower" layers like bridges (which should have low positive values).

In the Qt code, the initialization for the route is done in OverlayObject.cpp/OverlayWay::toWay (and functions called from there).

In the header, you see that Overlay objects have

  int8_t                              layer{std::numeric_limits<int8_t>::max()};

:-)

I assume some of these internal "tricks" are missing in your code?

from libosmscout.

Framstag avatar Framstag commented on June 3, 2024

@Karry : Right?

We also have zIndex. I do not remember the purpose of this one. Karry, can you help? We should also document it ;-)

from libosmscout.

Karry avatar Karry commented on June 3, 2024

Just see "Section ORDER WAYS" in our documentation

This section defines in which order ways are rendered. It defines a number groups which contains ways types. Ways types in the same group have the same rendering priority. Groups further down the style sheet are rendered below ways further up in the GROUP list. Rendering order is only relevant if ways of different types cross each other. Note that ways are first ordered by layer, then within a layer by rendering priority. So a bridge will always be rendered on top a “bridged” way, a tunnel always below a “tunneled” ways.

And yes, in Qt, I just setup layer to maximum for "overlay" objects.

Regarding zIndex, it is really missing in documentation. Looking to stylesheets, it seems to me that it is used just for way decorations - to render outlines first. With that, I would guess that zIndex is used as last property for sorting (just order individual lines for the same way), but looking to the code, sorting order is: layer, zIndex, style priority, style sheet priority (ORDER WAYS). Should we change it?

from libosmscout.

vyskocil avatar vyskocil commented on June 3, 2024

Thank you @Framstag and @Karry for the hints, I checked all this in my code, tried to use the standard.oss stylesheet from the distribution but the rendering is still the same...
Maybe the issue is in the code I use to inject the _route path ?

       std::vector<RenderSteps> renderSteps {
            FirstStep, DrawAreas, DrawWays, DrawHillShading, DrawLabels, LastStep
        };
        
        unsigned long lastMapIndex = ctx->mapServices.size() - 1;
        
        for (int step = 0; step < renderSteps.size()/2; step++) {
            
            RenderSteps startRenderStep = renderSteps[step*2];
            RenderSteps endRenderStep = renderSteps[step*2 + 1];
            
            // render the active maps
            for(int i = 0; i <= lastMapIndex; i++){
...
                // Append the routeWay data in the last rendered database to paint it on top
                if (i == lastMapIndex && step == 0 && routeWay) {
                    TypeInfoRef type=ctx->databases[i]->GetTypeConfig()->GetTypeInfo("_route");
                                        
                    osmscout::FeatureValueBuffer features;
                    size_t featureIndex;
                    features.SetType(type);
                    if (type->GetFeature(osmscout::LayerFeature::NAME,
                                         featureIndex)) {
                        auto* value=dynamic_cast<osmscout::LayerFeatureValue*>(features.AllocateValue(featureIndex));
                        assert(value);
                        value->SetLayer(std::numeric_limits<int8_t>::max());
                    }
                    
                    if (type){
                        if(routeWay){
                            if (!routeWay->GetType()) {
                                routeWay->SetType(type);
                            }
                            ctx->datas[i].ways.push_back(routeWay);
                        }
                      }
...

from libosmscout.

vyskocil avatar vyskocil commented on June 3, 2024

Thank you @Karry, this is the solution !

from libosmscout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.