[mapguide-commits] r9608 - sandbox/jng/mvt_alt/Common/Renderers/mvt
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Sep 21 12:49:17 PDT 2019
Author: jng
Date: 2019-09-21 12:49:17 -0700 (Sat, 21 Sep 2019)
New Revision: 9608
Removed:
sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.cpp
sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.h
Log:
Remove some mvt code that I don't think we need.
Deleted: sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.cpp
===================================================================
--- sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.cpp 2019-09-21 19:45:09 UTC (rev 9607)
+++ sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.cpp 2019-09-21 19:49:17 UTC (rev 9608)
@@ -1,218 +0,0 @@
-/******************************************************************************
- *
- * Project: MVT Translator
- * Purpose: Mapbox Vector Tile decoder
- * Author: Even Rouault, Even Rouault <even dot rouault at spatialys dot com>
- *
- ******************************************************************************
- * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- ****************************************************************************/
-
-#include "mvtutils.h"
-#include "ogr_api.h"
-
-/************************************************************************/
-/* OGRMVTInitFields() */
-/************************************************************************/
-
-void OGRMVTInitFields(OGRFeatureDefn* poFeatureDefn,
- const CPLJSONObject& oFields)
-{
- {
- OGRFieldDefn oFieldDefnId("mvt_id", OFTInteger64);
- poFeatureDefn->AddFieldDefn(&oFieldDefnId);
- }
-
- if( oFields.IsValid() )
- {
- for( const auto& oField: oFields.GetChildren() )
- {
- if( oField.GetType() == CPLJSONObject::String )
- {
- if( oField.ToString() == "Number" )
- {
- OGRFieldDefn oFieldDefn(
- oField.GetName().c_str(), OFTReal );
- poFeatureDefn->AddFieldDefn(&oFieldDefn);
- }
- else if( oField.ToString() == "Integer" ) // GDAL extension
- {
- OGRFieldDefn oFieldDefn(
- oField.GetName().c_str(), OFTInteger );
- poFeatureDefn->AddFieldDefn(&oFieldDefn);
- }
- else if( oField.ToString() == "Boolean" )
- {
- OGRFieldDefn oFieldDefn(
- oField.GetName().c_str(), OFTInteger );
- oFieldDefn.SetSubType(OFSTBoolean);
- poFeatureDefn->AddFieldDefn(&oFieldDefn);
- }
- else
- {
- OGRFieldDefn oFieldDefn(
- oField.GetName().c_str(), OFTString );
- poFeatureDefn->AddFieldDefn(&oFieldDefn);
- }
- }
- }
- }
-}
-
-/************************************************************************/
-/* OGRMVTFindGeomTypeFromTileStat() */
-/************************************************************************/
-
-OGRwkbGeometryType OGRMVTFindGeomTypeFromTileStat(
- const CPLJSONArray& oTileStatLayers,
- const char* pszLayerName)
-{
- OGRwkbGeometryType eGeomType = wkbUnknown;
- for( int i = 0; i < oTileStatLayers.Size(); i++ )
- {
- CPLJSONObject oId =
- oTileStatLayers[i].GetObj("layer");
- if( oId.IsValid() && oId.GetType() ==
- CPLJSONObject::String )
- {
- if( oId.ToString() == pszLayerName )
- {
- CPLJSONObject oGeom =
- oTileStatLayers[i].GetObj("geometry");
- if( oGeom.IsValid() && oGeom.GetType() ==
- CPLJSONObject::String )
- {
- const std::string oGeomType(
- oGeom.ToString());
- // Note: this information is not
- // reliable in case
- // of mix of geometry types
- if( oGeomType == "Point" )
- {
- eGeomType = wkbMultiPoint;
- }
- else if( oGeomType == "LineString" )
- {
- eGeomType = wkbMultiLineString;
- }
- else if( oGeomType == "Polygon" )
- {
- eGeomType = wkbMultiPolygon;
- }
- }
- break;
- }
- }
- }
- return eGeomType;
-}
-
-
-/************************************************************************/
-/* OGRMVTCreateFeatureFrom() */
-/************************************************************************/
-
-OGRFeature* OGRMVTCreateFeatureFrom(OGRFeature* poSrcFeature,
- OGRFeatureDefn* poTargetFeatureDefn,
- bool bJsonField,
- OGRSpatialReference* poSRS)
-{
- OGRFeature* poFeature = new OGRFeature(poTargetFeatureDefn);
- if( bJsonField )
- {
- CPLJSONObject oProperties;
- bool bEmpty = true;
- for( int i = 1; i < poSrcFeature->GetFieldCount(); i++ )
- {
- if( poSrcFeature->IsFieldSet(i) )
- {
- bEmpty = false;
- OGRFieldDefn* poFDefn = poSrcFeature->GetFieldDefnRef(i);
- if( poSrcFeature->IsFieldNull(i) )
- {
- oProperties.AddNull(poFDefn->GetNameRef());
- }
- else if( poFDefn->GetType() == OFTInteger ||
- poFDefn->GetType() == OFTInteger64 )
- {
- if( poFDefn->GetSubType() == OFSTBoolean )
- {
- oProperties.Add(poFDefn->GetNameRef(),
- poSrcFeature->GetFieldAsInteger(i) == 1);
- }
- else
- {
- oProperties.Add(poFDefn->GetNameRef(),
- poSrcFeature->GetFieldAsInteger64(i));
- }
- }
- else if( poFDefn->GetType() == OFTReal )
- {
- oProperties.Add(poFDefn->GetNameRef(),
- poSrcFeature->GetFieldAsDouble(i));
- }
- else
- {
- oProperties.Add(poFDefn->GetNameRef(),
- poSrcFeature->GetFieldAsString(i));
- }
- }
- }
- if( !bEmpty )
- {
- poFeature->SetField("json",
- oProperties.Format(CPLJSONObject::Pretty).c_str());
- }
-
- OGRGeometry* poSrcGeom = poSrcFeature->GetGeometryRef();
- if( poSrcGeom )
- {
- poFeature->SetGeometry( poSrcGeom );
- }
-#ifdef nodef
- CPLJSONObject oObj;
- oObj.Add("type", "Feature");
- if( poSrcFeature->IsFieldSet(0) )
- oObj.Add("id", poSrcFeature->GetFieldAsInteger64("mvt_id"));
- oObj.Add("properties", oProperties);
- if( poSrcGeom )
- {
- char* pszGeomJson = OGR_G_ExportToJson(
- reinterpret_cast<OGRGeometryH>(poSrcGeom) );
- CPLJSONDocument oJSonDoc;
- oJSonDoc.LoadMemory(reinterpret_cast<const GByte*>(pszGeomJson));
- CPLFree(pszGeomJson);
- oObj.Add( "geometry", oJSonDoc.GetRoot() );
- }
- poFeature->SetNativeData(
- oObj.Format(CPLJSONObject::Pretty).c_str());
- poFeature->SetNativeMediaType("application/vnd.geo+json");
-#endif
- }
- else
- {
- poFeature->SetFrom( poSrcFeature );
- }
- OGRGeometry* poGeom = poFeature->GetGeometryRef();
- if( poGeom )
- poGeom->assignSpatialReference(poSRS);
- return poFeature;
-}
Deleted: sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.h
===================================================================
--- sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.h 2019-09-21 19:45:09 UTC (rev 9607)
+++ sandbox/jng/mvt_alt/Common/Renderers/mvt/mvtutils.h 2019-09-21 19:49:17 UTC (rev 9608)
@@ -1,91 +0,0 @@
-/******************************************************************************
- *
- * Project: MVT Translator
- * Purpose: Mapbox Vector Tile decoder
- * Author: Even Rouault, Even Rouault <even dot rouault at spatialys dot com>
- *
- ******************************************************************************
- * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- ****************************************************************************/
-
-#ifndef MVTUTILS_H
-#define MVTUTILS_H
-
-#include "cpl_json.h"
-#include "ogrsf_frmts.h"
-
-#define MVT_LCO \
-"<LayerCreationOptionList>" \
-" <Option name='MINZOOM' type='int' min='0' max='22' " \
- "description='Minimum zoom level'/>" \
-" <Option name='MAXZOOM' type='int' min='0' max='22' " \
- "description='Maximum zoom level'/>" \
-" <Option name='NAME' type='string' description='Target layer name'/>" \
-" <Option name='DESCRIPTION' type='string' " \
- "description='A description of the layer'/>" \
-"</LayerCreationOptionList>"
-
-#define MVT_MBTILES_COMMON_DSCO \
-" <Option name='MINZOOM' scope='vector' type='int' min='0' max='22' " \
- "description='Minimum zoom level' default='0'/>" \
-" <Option name='MAXZOOM' scope='vector' type='int' min='0' max='22' " \
- "description='Maximum zoom level' default='5'/>" \
-" <Option name='CONF' scope='vector' type='string' " \
- "description='Layer configuration as a JSon serialized string, or a filename pointing to a JSon file'/>" \
-" <Option name='SIMPLIFICATION' scope='vector' type='float' " \
- "description='Simplification factor'/>" \
-" <Option name='SIMPLIFICATION_MAX_ZOOM' scope='vector' type='float' " \
- "description='Simplification factor at max zoom'/>" \
-" <Option name='EXTENT' scope='vector' type='unsigned int' default='4096' " \
- "description='Number of units in a tile'/>" \
-" <Option name='BUFFER' scope='vector' type='unsigned int' default='80' " \
- "description='Number of units for geometry buffering'/>" \
-" <Option name='COMPRESS' scope='vector' type='boolean' description=" \
- "'Whether to deflate-compress tiles' default='YES'/>" \
-" <Option name='TEMPORARY_DB' scope='vector' type='string' description='" \
- "Filename with path for the temporary database'/>" \
-" <Option name='MAX_SIZE' scope='vector' type='unsigned int' min='100' default='500000' " \
- "description='Maximum size of a tile in bytes'/>" \
-" <Option name='MAX_FEATURES' scope='vector' type='unsigned int' min='1' default='200000' " \
- "description='Maximum number of features per tile'/>"
-
-void OGRMVTInitFields(OGRFeatureDefn* poFeatureDefn,
- const CPLJSONObject& oFields);
-
-OGRwkbGeometryType OGRMVTFindGeomTypeFromTileStat(
- const CPLJSONArray& oTileStatLayers,
- const char* pszLayerName);
-
-OGRFeature* OGRMVTCreateFeatureFrom(OGRFeature* poSrcFeature,
- OGRFeatureDefn* poTargetFeatureDefn,
- bool bJsonField,
- OGRSpatialReference* poSRS);
-
-#ifdef HAVE_MVT_WRITE_SUPPORT
-GDALDataset* OGRMVTWriterDatasetCreate( const char * pszFilename,
- int nXSize,
- int nYSize,
- int nBandsIn,
- GDALDataType eDT,
- char ** papszOptions );
-#endif
-
-#endif // MVTUTILS_H
More information about the mapguide-commits
mailing list