Q&A - Question

Painting Shape

Question
MiaS asked on September 22, 2017, keyword: Developer Kernel
Hello Dev Team,

i have a problem with the newiest DK11 in painting a Shape Polygon.

i use this code which works in DK10 without any problems but in DK11 the ControlLegend.GisLayer is still nil.
 
      LayerPolygon.Build(layerpfad, GIS.Extent, gisShapeTypePolygon);
      LayerPolygon.name := layername;
      LayerPolygon.path := layerpfad;
      LayerPolygon.Caption := Beschriftung;

      // speichere einmalig das shp auf die Festplatte
      LayerPolygon.SaveAll;

      if FileExists(LayerPolygon.path) then
      begin
        // Weise editierLayer den neu erzeugten Layer zu
        editLayer := TGIS_LayerVector.Create;
        editLayer.path := LayerPolygon.path;
        TGIS_LayerSHP(editLayer).Params.Area.Color := TGIS_Color.blue;
        TGIS_LayerSHP(editLayer).Params.Area.OutlineWidth := 25;
//        editLayer.Params.
        editLayer.Transparency := 60;
        editLayer.SaveAll;

        // Lege Gruppen an, wenn nicht vorhanden
        if not Assigned(GIS.Hierarchy.Groups['Zeichnungen']) then
        begin
          group := GIS.Hierarchy.CreateGroup('Zeichnungen');
        end
        else
        begin
          group := GIS.Hierarchy.Groups['Zeichnungen'];
        end;

        GIS.add(editLayer);
        group.addlayer(editLayer);

        GIS_ControlLegend1.Update;


        GIS_ControlLegend1.GIS_Layer := TGIS_Layer(editLayer);

        shpPolygon := TGIS_ShapePolygon(TGIS_LayerVector(editLayer).CreateShape(gisShapeTypePolygon));
        if shpPolygon <> nil then
        begin
          shpPolygon.Lock(gisLockExtent);
          shpPolygon.AddPart;
        end;

        GIS.Editor.EditorMode := TGIS_EditorModeEx.Normal;
        GIS.mode := gisEdit;
        GIS.Update;
can someone explain me why?
Answers
Artur Redzko (TatukGIS) replied September 22, 2017
Update method doesn't work anymore like in DK 10. Instead use GIS_ControlLegend1.InvalidateItems and GIS.InvalidateWholeMap.
If you would like to answer the question please Sign In.
*
*
Please review our recent Privacy Policy.
If you have any questions or requests, please contact us.
Rules
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
 
  1. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
  2. Keep the content positive and professional.
  3. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
  4. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.