Esempio n. 1
0
int KmlRenderer::closeNewLayer(imageObj *img, layerObj *layer)
{
  flushPlacemark();

  xmlAddChild(DocNode, LayerNode);

  if(Items) {
    msFreeCharArray(Items, NumItems);
    Items = NULL;
    NumItems = 0;
  }

  if (pszLayerDescMetadata)
    pszLayerDescMetadata = NULL;
  if (pszLayerNameAttributeMetadata)
    pszLayerNameAttributeMetadata = NULL;

  if (papszLayerIncludeItems && nIncludeItems>0)
    msFreeCharArray(papszLayerIncludeItems, nIncludeItems);
  papszLayerIncludeItems=NULL;

  if (papszLayerExcludeItems && nExcludeItems>0)
    msFreeCharArray(papszLayerExcludeItems, nExcludeItems);
  papszLayerExcludeItems=NULL;

  return MS_SUCCESS;
}
Esempio n. 2
0
void KmlRenderer::startShape(imageObj *, shapeObj *shape)
{
    if (PlacemarkNode)
      flushPlacemark();

    CurrentShapeIndex=-1;
    CurrentDrawnShapeIndex = -1;
    CurrentShapeName=NULL;

    /*should be done at endshape but the plugin architecture does not call endshape yet*/
    if(LineStyle)
    {
        msFree(LineStyle);

        LineStyle = NULL;
        numLineStyle = 0;
    }

    if (shape)
    {
        CurrentShapeIndex = shape->index;
        if (pszLayerNameAttributeMetadata)
        {
            for (int i=0; i<currentLayer->numitems; i++)
            {
                if (strcasecmp(currentLayer->items[i], pszLayerNameAttributeMetadata) == 0 && shape->values[i])
                {
                    CurrentShapeName = msStrdup(shape->values[i]);
                    break;
                }
            }
        }
    }
    PlacemarkNode = NULL;
    GeomNode = NULL;

    DescriptionNode = createDescriptionNode(shape);

    if( mElevationFromAttribute && shape->numvalues > mElevationAttributeIndex && 
        mElevationAttributeIndex >= 0 && shape->values[mElevationAttributeIndex])
    {
        mCurrentElevationValue = atof( shape->values[mElevationAttributeIndex] );
    }


    memset(SymbologyFlag, 0, NumSymbologyFlag);
}