QGCMapPolygon

Hi, I saw that the functions defined in ‘QGCMapPolygonVisuals.qml’ provide access to the functions defined in QGCMapPolygon.cc. Where is the connection between these two established? I’ll be happy if you can help me.

  function _resetPolygon() {
        mapPolygon.beginReset()
        mapPolygon.clear()
        mapPolygon.appendVertices(defaultPolygonVertices())
        mapPolygon.endReset()
        _circleMode = false
    }
  • These functions are called from QGCMapPolygon.
beginReset()
clear()
appendVertices()

mapPolygon object is set when QGCMapPolygonVisuals element is instantiated. Check GeoFenceMapVisuals.qml,

Instantiator {
        model: _polygons

        delegate : QGCMapPolygonVisuals {
            parent:             _root
            mapControl:         map
            mapPolygon:         object  // ***This is where the object is passed ***
            borderWidth:        object.inclusion ? _borderWidthInclusion : _borderWidthExclusion
            borderColor:        _borderColor
            interiorColor:      object.inclusion ? _interiorColorInclusion : _interiorColorExclusion
            interiorOpacity:    object.inclusion ? _interiorOpacityInclusion : _interiorOpacityExclusion
            interactive:        _root.interactive && mapPolygon && mapPolygon.interactive
        }
    }

Hope this helps.

Thank yo so much! IThis is a different way of doing what I want!

1 Like