Skip to content

Commit

Permalink
Improvements on some width fields. A error -> warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelPau committed Apr 11, 2024
1 parent 6094829 commit bee18c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
10 changes: 10 additions & 0 deletions ogr/ogrsf_frmts/miramon/mm_gdal_driver_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ CPL_C_START // Necessary for compiling in GDAL project
#define szMMNomCampNArcsDefecte "N_ARCS"
#define szMMNomCampNPoligonsDefecte "N_POLIG"

// Initial width of MiraMon fields
#define MM_MIN_WIDTH_ID_GRAFIC 3
#define MM_MIN_WIDTH_N_VERTEXS 5
#define MM_MIN_WIDTH_INITIAL_NODE MM_MIN_WIDTH_ID_GRAFIC + 1
#define MM_MIN_WIDTH_FINAL_NODE MM_MIN_WIDTH_ID_GRAFIC + 1
#define MM_MIN_WIDTH_ARCS_TO_NODE 1

#define MM_MIN_WIDTH_N_ARCS 2
#define MM_MIN_WIDTH_N_POLIG 2

// Types of layers in MiraMon
#define MM_LayerType_Unknown 0 // Unknown type, or DBF alone
#define MM_LayerType_Point 1 // Layer of Points
Expand Down
22 changes: 11 additions & 11 deletions ogr/ogrsf_frmts/miramon/mm_gdal_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,14 +2014,14 @@ size_t MM_DefineFirstPolygonFieldsDB_XP(struct MM_DATA_BASE_XP *bd_xp,
MM_FillFieldDB_XP(
bd_xp->pField + i_camp, szMMNomCampIdGraficDefecte,
szInternalGraphicIdentifierEng, szInternalGraphicIdentifierCat,
szInternalGraphicIdentifierSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szInternalGraphicIdentifierSpa, 'N', MM_MIN_WIDTH_ID_GRAFIC, 0);
bd_xp->IdGraficField = 0;
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_ID_GRAFIC;
i_camp++;

MM_FillFieldDB_XP(bd_xp->pField + i_camp, szMMNomCampNVertexsDefecte,
szNumberOfVerticesEng, szNumberOfVerticesCat,
szNumberOfVerticesSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szNumberOfVerticesSpa, 'N', MM_MIN_WIDTH_N_VERTEXS, 0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_N_VERTEXS;
i_camp++;

Expand All @@ -2041,14 +2041,14 @@ size_t MM_DefineFirstPolygonFieldsDB_XP(struct MM_DATA_BASE_XP *bd_xp,

MM_FillFieldDB_XP(bd_xp->pField + i_camp, szMMNomCampNArcsDefecte,
szNumberOfArcsEng, szNumberOfArcsCat, szNumberOfArcsSpa,
'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
'N', MM_MIN_WIDTH_N_ARCS, 0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_N_ARCS;
i_camp++;

MM_FillFieldDB_XP(
bd_xp->pField + i_camp, szMMNomCampNPoligonsDefecte,
szNumberOfElementaryPolygonsEng, szNumberOfElementaryPolygonsCat,
szNumberOfElementaryPolygonsSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szNumberOfElementaryPolygonsSpa, 'N', MM_MIN_WIDTH_N_POLIG, 0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_N_POLIG;
i_camp++;

Expand All @@ -2064,14 +2064,14 @@ size_t MM_DefineFirstArcFieldsDB_XP(struct MM_DATA_BASE_XP *bd_xp,
MM_FillFieldDB_XP(
bd_xp->pField + i_camp, szMMNomCampIdGraficDefecte,
szInternalGraphicIdentifierEng, szInternalGraphicIdentifierCat,
szInternalGraphicIdentifierSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szInternalGraphicIdentifierSpa, 'N', MM_MIN_WIDTH_ID_GRAFIC, 0);
bd_xp->IdGraficField = 0;
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_ID_GRAFIC;
i_camp++;

MM_FillFieldDB_XP(bd_xp->pField + i_camp, szMMNomCampNVertexsDefecte,
szNumberOfVerticesEng, szNumberOfVerticesCat,
szNumberOfVerticesSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szNumberOfVerticesSpa, 'N', MM_MIN_WIDTH_N_VERTEXS, 0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_N_VERTEXS;
i_camp++;

Expand All @@ -2083,13 +2083,13 @@ size_t MM_DefineFirstArcFieldsDB_XP(struct MM_DATA_BASE_XP *bd_xp,

MM_FillFieldDB_XP(bd_xp->pField + i_camp, szMMNomCampNodeIniDefecte,
szInitialNodeEng, szInitialNodeCat, szInitialNodeSpa, 'N',
MM_MAX_AMPLADA_CAMP_N_DBF, 0);
MM_MIN_WIDTH_INITIAL_NODE, 0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_NODE_INI;
i_camp++;

MM_FillFieldDB_XP(bd_xp->pField + i_camp, szMMNomCampNodeFiDefecte,
szFinalNodeEng, szFinalNodeCat, szFinalNodeSpa, 'N',
MM_MAX_AMPLADA_CAMP_N_DBF, 0);
MM_MIN_WIDTH_FINAL_NODE, 0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_NODE_FI;
i_camp++;

Expand All @@ -2105,14 +2105,14 @@ size_t MM_DefineFirstNodeFieldsDB_XP(struct MM_DATA_BASE_XP *bd_xp)
MM_FillFieldDB_XP(
bd_xp->pField + i_camp, szMMNomCampIdGraficDefecte,
szInternalGraphicIdentifierEng, szInternalGraphicIdentifierCat,
szInternalGraphicIdentifierSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szInternalGraphicIdentifierSpa, 'N', MM_MIN_WIDTH_ID_GRAFIC, 0);
bd_xp->IdGraficField = 0;
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_ID_GRAFIC;
i_camp++;

MM_FillFieldDB_XP(bd_xp->pField + i_camp, szMMNomCampArcsANodeDefecte,
szNumberOfArcsToNodeEng, szNumberOfArcsToNodeCat,
szNumberOfArcsToNodeSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF,
szNumberOfArcsToNodeSpa, 'N', MM_MIN_WIDTH_ARCS_TO_NODE,
0);
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_ARCS_A_NOD;
i_camp++;
Expand All @@ -2132,7 +2132,7 @@ size_t MM_DefineFirstPointFieldsDB_XP(struct MM_DATA_BASE_XP *bd_xp)
MM_FillFieldDB_XP(
bd_xp->pField + i_camp, szMMNomCampIdGraficDefecte,
szInternalGraphicIdentifierEng, szInternalGraphicIdentifierCat,
szInternalGraphicIdentifierSpa, 'N', MM_MAX_AMPLADA_CAMP_N_DBF, 0);
szInternalGraphicIdentifierSpa, 'N', MM_MIN_WIDTH_ID_GRAFIC, 0);
bd_xp->IdGraficField = 0;
(bd_xp->pField + i_camp)->GeoTopoTypeField = (MM_BYTE)MM_CAMP_ES_ID_GRAFIC;
i_camp++;
Expand Down
6 changes: 3 additions & 3 deletions ogr/ogrsf_frmts/miramon/mm_wrlayr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7075,9 +7075,9 @@ int MMAddPolygonRecordToMMDB(struct MiraMonVectLayerInfo *hMiraMonLayer,
if (hMMFeature && hMMFeature->nNumMRecords &&
hMMFeature->pRecords[0].nNumField)
{
if (MMDetectAndFixDBFWidthChange(
hMiraMonLayer, hMMFeature, &hMiraMonLayer->MMPolygon.MMAdmDB,
pFlushRecList, nNumPrivateMMField, 0, 0))
if (MMDetectAndFixDBFWidthChange(hMiraMonLayer, hMMFeature,
&hMiraMonLayer->MMPolygon.MMAdmDB,
pFlushRecList, 0, 0, 0))
return MM_FATAL_ERROR_WRITING_FEATURES;
}

Expand Down
4 changes: 2 additions & 2 deletions ogr/ogrsf_frmts/miramon/ogrmiramonlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2349,10 +2349,10 @@ OGRErr OGRMiraMonLayer::TranslateFieldsValuesToMM(OGRFeature *poFeature)
}
else
{
CPLError(CE_Failure, CPLE_NotSupported,
CPLError(CE_Warning, CPLE_NotSupported,
"MiraMon: Field type %d not processed by MiraMon\n",
eFType);
return OGRERR_UNSUPPORTED_GEOMETRY_TYPE;
hMMFeature.pRecords[0].pField[iField].bIsValid = 0;
}
}

Expand Down

0 comments on commit bee18c5

Please sign in to comment.