本文整理汇总了C++中DBGridIF::RenameLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ DBGridIF::RenameLayer方法的具体用法?C++ DBGridIF::RenameLayer怎么用?C++ DBGridIF::RenameLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBGridIF
的用法示例。
在下文中一共展示了DBGridIF::RenameLayer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RGISEditGridRenameLayerCBK
void RGISEditGridRenameLayerCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *layerName;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data ();
DBGridIF *gridIF;
if ((layerName = UIGetString ((char *) "Layer Name",DBStringLength)) == (char *) NULL) return;
gridIF= new DBGridIF (dbData);
gridIF->RenameLayer (layerName);
delete gridIF;
workspace->CurrentData (dbData);
}
示例2: _CMDnetErosion
int _CMDnetErosion(DBObjData *netData, DBObjData *inData, DBObjData *weightData,
DBObjData *outData, DBFloat coeff, DBInt areaMult) {
DBInt ret = DBSuccess, layerID, cellID, progress, maxProgress;
DBFloat inValue, weight, outValue, *sumWeights;
DBPosition pos;
DBNetworkIF *netIF = new DBNetworkIF(netData);
DBGridIF *inIF = new DBGridIF(inData);
DBGridIF *outIF = new DBGridIF(outData);
DBGridIF *weightIF = weightData != (DBObjData *) NULL ? new DBGridIF(weightData) : (DBGridIF *) NULL;
DBObjRecord *inLayerRec, *outLayerRec, *weightLayerRec, *cellRec, *toCell;
if ((sumWeights = (DBFloat *) calloc(netIF->CellNum(), sizeof(DBFloat))) == (DBFloat *) NULL) {
CMmsgPrint(CMmsgSysError, "Memory allocation error in: %s %d", __FILE__, __LINE__);
ret = DBFault;
goto Stop;
}
layerID = 0;
inLayerRec = inIF->Layer(layerID);
outLayerRec = outIF->Layer(layerID);
outIF->RenameLayer(outLayerRec, inLayerRec->Name());
outValue = outIF->MissingValue(outLayerRec);
for (pos.Row = 0; pos.Row < outIF->RowNum(); pos.Row++)
for (pos.Col = 0; pos.Col < outIF->ColNum(); pos.Col++) outIF->Value(outLayerRec, pos, outValue);
for (layerID = 1; layerID < inIF->LayerNum(); ++layerID) {
inLayerRec = inIF->Layer(layerID);
if ((outLayerRec = outIF->AddLayer(inLayerRec->Name())) == (DBObjRecord *) NULL) {
ret = DBFault;
goto Stop;
}
for (pos.Row = 0; pos.Row < outIF->RowNum(); pos.Row++)
for (pos.Col = 0; pos.Col < outIF->ColNum(); pos.Col++) outIF->Value(outLayerRec, pos, outValue);
}
maxProgress = inIF->LayerNum() * netIF->CellNum();
for (layerID = 0; layerID < inIF->LayerNum(); ++layerID) {
inLayerRec = inIF->Layer(layerID);
outLayerRec = outIF->Layer(layerID);
if (weightIF != (DBGridIF *) NULL)
weightLayerRec = weightIF->Layer(layerID % weightIF->LayerNum());
for (cellID = 0; cellID < netIF->CellNum(); cellID++) {
sumWeights[cellID] = 0.0;
cellRec = netIF->Cell(cellID);
if (inIF->Value(inLayerRec, netIF->Center(cellRec), &inValue) == false)
outIF->Value(outLayerRec, netIF->CellPosition(cellRec), 0.0);
else {
if (weightIF != (DBGridIF *) NULL)
weight = weightIF->Value(weightLayerRec, netIF->Center(cellRec), &weight) == false ?
0.0 : weight * coeff;
else weight = coeff;
if (areaMult) weight = weight * netIF->CellArea(cellRec);
sumWeights[cellID] = weight;
outIF->Value(outLayerRec, netIF->CellPosition(cellRec), inValue * weight);
}
}
for (cellID = netIF->CellNum() - 1; cellID >= 0; --cellID) {
progress = layerID * netIF->CellNum() + (netIF->CellNum() - cellID);
if (DBPause(progress * 100 / maxProgress)) goto Stop;
cellRec = netIF->Cell(cellID);
if ((toCell = netIF->ToCell(cellRec)) == (DBObjRecord *) NULL) continue;
if (outIF->Value(outLayerRec, netIF->CellPosition(cellRec), &inValue) == false) continue;
if (outIF->Value(outLayerRec, netIF->CellPosition(toCell), &outValue) == false) continue;
sumWeights[toCell->RowID()] = sumWeights[toCell->RowID()] + weight;
outIF->Value(outLayerRec, netIF->CellPosition(toCell), outValue + inValue);
}
outIF->RecalcStats(outLayerRec);
}
free(sumWeights);
Stop:
delete netIF;
delete inIF;
delete outIF;
if (weightIF != (DBGridIF *) NULL) delete weightIF;
return (ret);
}
示例3: DBPointToGrid
DBInt DBPointToGrid(DBObjData *pntData, DBObjData *grdData, DBFloat factor) {
DBInt startID, pnt0ID, pntID, id, itemNum;
double dist, minDist, box, box0, bWidth, bHeight;
DBPosition pos;
DBCoordinate gCoord, *pCoord;
DBObjRecord *grdRec, *pntRec, *symRec;
DBObjTable *itemTable, *symTable;
DBObjTableField *valField, *symField;
DBVPointIF *pntIF;
DBGridIF *gridIF;
DBMathDistanceFunction distFunc = DBMathGetDistanceFunction(pntData);
if (distFunc != DBMathGetDistanceFunction(grdData)) {
CMmsgPrint(CMmsgAppError, "Incompatible projections in: %s %d", __FILE__, __LINE__);
return (DBFault);
}
pntIF = new DBVPointIF(pntData);
itemNum = pntIF->ItemNum();
if ((pCoord = (DBCoordinate *) calloc(itemNum, sizeof(DBCoordinate))) == (DBCoordinate *) NULL) {
CMmsgPrint(CMmsgSysError, "Memory allocation Error in: %s %d", __FILE__, __LINE__);
return (DBFault);
}
gridIF = new DBGridIF(grdData);
for (pntID = 0; pntID < itemNum; ++pntID) pCoord[pntID] = pntIF->Coordinate(pntIF->Item(pntID));
if (grdData->Type() == DBTypeGridContinuous)
gridIF->RenameLayer(gridIF->Layer((DBInt) 0), (char *) "Distance to Station");
else {
gridIF->RenameLayer(gridIF->Layer((DBInt) 0), (char *) "Station grid");
itemTable = grdData->Table(DBrNItems);
symTable = grdData->Table(DBrNSymbols);
valField = itemTable->Field(DBrNGridValue);
symField = itemTable->Field(DBrNSymbol);
if ((symRec = symTable->Item(0)) == (DBObjRecord *) NULL)
CMmsgPrint(CMmsgAppError, "Total Metal Gebasz in: %s %d", __FILE__, __LINE__);
for (pntID = 0; pntID < itemNum; ++pntID) {
pntRec = pntIF->Item(pntID);
grdRec = itemTable->Add(pntRec->Name());
valField->Int(grdRec, pntID + 1);
symField->Record(grdRec, symRec);
}
}
startID = 0;
for (pos.Row = 0; pos.Row < gridIF->RowNum(); ++pos.Row) {
DBPause(pos.Row * 100 / gridIF->RowNum());
for (pos.Col = 0; pos.Col < gridIF->ColNum(); ++pos.Col) {
gridIF->Pos2Coord(pos, gCoord);
minDist = box0 = DBHugeVal;
pnt0ID = pntID = startID;
id = DBFault;
do {
bWidth = fabs(gCoord.X - pCoord[pntID].X);
bHeight = fabs(gCoord.Y - pCoord[pntID].Y);
box = bWidth > bHeight ? bWidth : bHeight;
if ((box < box0) && ((dist = DBMathCoordinateDistance(distFunc, gCoord, pCoord[pntID])) < minDist)) {
minDist = dist;
id = startID = pntID;
box *= factor;
if (box0 > box) box0 = box;
}
pntID = pntID + 1 < itemNum ? pntID + 1 : 0;
} while (pntID != pnt0ID);
if (grdData->Type() == DBTypeGridContinuous) gridIF->Value(pos, minDist); else gridIF->Value(pos, id);
}
}
if (grdData->Type() == DBTypeGridContinuous) gridIF->RecalcStats(); else gridIF->DiscreteStats();
delete gridIF;
free(pCoord);
return (DBSuccess);
}
示例4: RGlibDataStream2RGIS
DBInt RGlibDataStream2RGIS(DBObjData *outData, DBObjData *tmplData, FILE *inFile) {
DBInt layerID = 0, itemSize;
DBPosition pos;
DBFloat val;
void *data = (void *) NULL;
MFVarHeader_t header;
DBObjRecord *record;
switch (tmplData->Type()) {
case DBTypeVectorPoint: {
DBInt itemID;
DBDate date;
DBObjTable *itemTable = outData->Table(DBrNItems);
DBObjTableField *idField = new DBObjTableField("ItemID", DBTableFieldInt, "%6d", sizeof(DBInt), false);
DBObjTableField *dateField = new DBObjTableField("Date", DBTableFieldDate, "%s", sizeof(DBDate), false);
DBObjTableField *valField;
DBVPointIF *pntIF = new DBVPointIF(tmplData);
itemTable->AddField(idField);
itemTable->AddField(dateField);
while (MFVarReadHeader(&header, inFile)) {
if (header.ItemNum != pntIF->ItemNum()) {
CMmsgPrint(CMmsgUsrError, "Error: Datastream inconsistency %d %d!", header.ItemNum,
pntIF->ItemNum());
return (DBFault);
}
if (data == (void *) NULL) {
itemSize = MFVarItemSize(header.DataType);
if ((data = (void *) realloc(data, header.ItemNum * itemSize)) == (void *) NULL) {
CMmsgPrint(CMmsgSysError, "Memory allocation error in: %s %d", __FILE__, __LINE__);
return (DBFault);
}
switch (header.DataType) {
case MFByte:
valField = new DBObjTableField("Value", DBTableFieldInt, "%2d", sizeof(char), false);
case MFShort:
valField = new DBObjTableField("Value", DBTableFieldInt, "%4d", sizeof(DBShort), false);
case MFInt:
valField = new DBObjTableField("Value", DBTableFieldInt, "%8d", sizeof(DBInt), false);
case MFFloat:
valField = new DBObjTableField("Value", DBTableFieldFloat, "%8.2f", sizeof(DBFloat4),
false);
case MFDouble:
valField = new DBObjTableField("Value", DBTableFieldFloat, "%8.2f", sizeof(DBFloat), false);
}
itemTable->AddField(valField);
}
if ((int) fread(data, itemSize, header.ItemNum, inFile) != header.ItemNum) {
CMmsgPrint(CMmsgSysError, "Error: Data stream read in: %s %d", __FILE__, __LINE__);
return (DBFault);
}
for (itemID = 0; itemID < header.ItemNum; ++itemID) {
record = itemTable->Add(header.Date);
date.Set(header.Date);
idField->Int(record, itemID);
dateField->Date(record, date);
/* decDateField->Float (record,date);
*/ switch (header.DataType) {
case MFByte:
valField->Int(record, ((char *) data)[itemID]);
break;
case MFShort:
valField->Int(record, ((short *) data)[itemID]);
break;
case MFInt:
valField->Int(record, ((int *) data)[itemID]);
break;
case MFFloat:
valField->Float(record, ((float *) data)[itemID]);
break;
case MFDouble:
valField->Float(record, ((double *) data)[itemID]);
break;
}
}
}
delete pntIF;
}
break;
case DBTypeGridContinuous:
case DBTypeGridDiscrete: {
DBGridIF *gridIF = new DBGridIF(outData);
while (MFVarReadHeader(&header, inFile)) {
if (header.ItemNum != gridIF->RowNum() * gridIF->ColNum()) {
CMmsgPrint(CMmsgUsrError, "Error: Datastream inconsistency!");
return (DBFault);
}
if (layerID == 0) {
itemSize = MFVarItemSize(header.DataType);
if ((data = (void *) realloc(data, header.ItemNum * itemSize)) == (void *) NULL) {
CMmsgPrint(CMmsgSysError, "Memory allocation error in: %s %d", __FILE__, __LINE__);
return (DBFault);
}
record = gridIF->Layer(layerID);
gridIF->RenameLayer(header.Date);
}
else record = gridIF->AddLayer(header.Date);
//.........这里部分代码省略.........
示例5: RenameLayer
void RenameLayer (DBGridIF *gridIF)
{
DBObjRecord *layerRec;
if ((layerRec = gridIF->Layer (LayerID - 1)) != (DBObjRecord *) NULL) gridIF->RenameLayer (layerRec,LayerName);
if (Next != (RenameCLS *) NULL) Next->RenameLayer (gridIF);
}
示例6: CMthreadProcessorNum
DBObjData *Compute(char *title, CMthreadUserExecFunc userFunc) {
DBInt i, layerID, dataLayerID;
size_t threadId;
DBPosition pos;
DBCoordinate coord;
char *layerName;
DBObjData *data;
DBObjRecord *record;
size_t threadsNum = CMthreadProcessorNum();
CMthreadTeam_t team;
CMthreadJob_p job = (CMthreadJob_p) NULL;
if (CMthreadTeamInitialize(&team, threadsNum) == (CMthreadTeam_p) NULL) {
CMmsgPrint (CMmsgUsrError,"Team initialization error %s, %d",__FILE__,__LINE__);
return ((DBObjData *) NULL);
}
if ((data = DBGridCreate(title, Extent, CellSize)) == (DBObjData *) NULL) return ((DBObjData *) NULL);
data->Projection(GrdVar[0]->Projection()); // Taking projection from first grid variable
GridIF = new DBGridIF(data);
if (team.ThreadNum > 0) {
if ((job = CMthreadJobCreate(GridIF->RowNum() * GridIF->ColNum(), userFunc, (void *) this)) ==
(CMthreadJob_p) NULL) {
CMmsgPrint(CMmsgAppError, "Job creation error in %s:%d", __FILE__, __LINE__);
CMthreadTeamDestroy(&team);
return ((DBObjData *) NULL);
}
for (threadId = 0; threadId < team.ThreadNum; ++threadId)
if (Table->Add("TEMPRecord") == (DBObjRecord *) NULL) {
CMthreadTeamDestroy(&team);
return ((DBObjData *) NULL);
}
}
else {
if ((record = Table->Add("TEMPRecord")) == (DBObjRecord *) NULL) return ((DBObjData *) NULL);
}
for (layerID = 0; layerID < LayerNum; ++layerID) {
layerName = GrdVar[MasterVar]->CurrentLayer(layerID);
for (i = 0; i < (DBInt) VarNum; ++i) {
if ((dataLayerID = GrdVar[i]->FindLayer(layerName)) != DBFault)
GrdVar[i]->CurrentLayer(dataLayerID);
else {
if (GrdVar[i]->LayerIsDated(0)) continue;
GrdVar[i]->CurrentLayer(dataLayerID);
}
}
if (layerID > 0) GridIF->AddLayer((char *) "New Layer");
LayerRec = GridIF->Layer(layerID);
GridIF->RenameLayer(LayerRec, layerName);
if (job != (CMthreadJob_p) NULL) CMthreadJobExecute(&team, job);
else
for (pos.Row = 0; pos.Row < GridIF->RowNum(); ++pos.Row)
for (pos.Col = 0; pos.Col < GridIF->ColNum(); ++pos.Col) {
GridIF->Pos2Coord(pos, coord);
for (i = 0; i < (DBInt) VarNum; ++i) GrdVar[i]->GetVariable(record, coord);
for (i = 0; i < (DBInt) ExpNum; ++i) Expressions[i]->Evaluate(record);
GridIF->Value(LayerRec, pos, Operand->Float(record));
}
GridIF->RecalcStats(LayerRec);
}
delete GridIF;
CMthreadTeamDestroy(&team);
return (data);
}
示例7: _CMDnetTransfer
int _CMDnetTransfer(DBObjData *netData,
DBObjData *inData,
DBObjData *weightData,
DBObjData *outData,
DBFloat coeff,
DBObjData *coeffData,
DBObjData *QData,
DBObjData *HLData,
DBFloat umax,
DBFloat ksat,
DBInt areaMult) {
DBInt ret = DBSuccess, layerID, cellID, progress, maxProgress;
DBFloat inValue, weight, outValue, *sumWeights, kCoeff, q, hl, Conc, Uptake, Vf;
DBPosition pos;
DBNetworkIF *netIF = new DBNetworkIF(netData);
DBGridIF *inIF = new DBGridIF(inData);
DBGridIF *outIF = new DBGridIF(outData);
DBGridIF *weightIF = weightData != (DBObjData *) NULL ? new DBGridIF(weightData) : (DBGridIF *) NULL;
DBGridIF *coeffIF = coeffData != (DBObjData *) NULL ? new DBGridIF(coeffData) : (DBGridIF *) NULL;
DBGridIF *Q_IF = QData != (DBObjData *) NULL ? new DBGridIF(QData) : (DBGridIF *) NULL;
DBGridIF *HL_IF = HLData != (DBObjData *) NULL ? new DBGridIF(HLData) : (DBGridIF *) NULL;
DBObjRecord *inLayerRec, *outLayerRec, *weightLayerRec, *coeffLayerRec, *Q_LayerRec, *HL_LayerRec, *cellRec, *toCell;
DBCoordinate coord;
if ((sumWeights = (DBFloat *) calloc(netIF->CellNum(), sizeof(DBFloat))) == (DBFloat *) NULL) {
CMmsgPrint(CMmsgSysError, "Memory allocation error in: %s %d", __FILE__, __LINE__);
ret = DBFault;
goto Stop;
}
layerID = 0;
inLayerRec = inIF->Layer(layerID);
outLayerRec = outIF->Layer(layerID);
outIF->RenameLayer(outLayerRec, inLayerRec->Name());
outValue = outIF->MissingValue(outLayerRec);
for (pos.Row = 0; pos.Row < outIF->RowNum(); pos.Row++)
for (pos.Col = 0; pos.Col < outIF->ColNum(); pos.Col++) outIF->Value(outLayerRec, pos, outValue);
for (layerID = 1; layerID < inIF->LayerNum(); ++layerID) {
inLayerRec = inIF->Layer(layerID);
if ((outLayerRec = outIF->AddLayer(inLayerRec->Name())) == (DBObjRecord *) NULL) {
ret = DBFault;
goto Stop;
}
for (pos.Row = 0; pos.Row < outIF->RowNum(); pos.Row++)
for (pos.Col = 0; pos.Col < outIF->ColNum(); pos.Col++) outIF->Value(outLayerRec, pos, outValue);
}
maxProgress = inIF->LayerNum() * netIF->CellNum();
for (layerID = 0; layerID < inIF->LayerNum(); ++layerID) {
inLayerRec = inIF->Layer(layerID);
outLayerRec = outIF->Layer(layerID);
if (weightIF != (DBGridIF *) NULL)
weightLayerRec = weightIF->Layer(layerID % weightIF->LayerNum());
if (coeffIF != (DBGridIF *) NULL)
coeffLayerRec = coeffIF->Layer(layerID % coeffIF->LayerNum());
if (Q_IF != (DBGridIF *) NULL)
Q_LayerRec = Q_IF->Layer(layerID % Q_IF->LayerNum());
if (HL_IF != (DBGridIF *) NULL)
HL_LayerRec = HL_IF->Layer(layerID % HL_IF->LayerNum());
for (cellID = 0; cellID < netIF->CellNum(); cellID++) {
sumWeights[cellID] = 0.0;
cellRec = netIF->Cell(cellID);
coord = netIF->Center(cellRec);
if (inIF->Value(inLayerRec, coord, &inValue) == false)
outIF->Value(outLayerRec, netIF->CellPosition(cellRec), 0.0);
else {
if (weightIF != (DBGridIF *) NULL)
weight = weightIF->Value(weightLayerRec, coord, &weight) == false ?
0.0 : weight * coeff;
else weight = coeff;
if (areaMult) weight = weight * netIF->CellArea(cellRec);
sumWeights[cellID] = weight;
outIF->Value(outLayerRec, netIF->CellPosition(cellRec), inValue * weight);
}
}
for (cellID = netIF->CellNum() - 1; cellID >= 0; --cellID) {
progress = layerID * netIF->CellNum() + (netIF->CellNum() - cellID);
if (DBPause(progress * 100 / maxProgress)) goto Stop;
cellRec = netIF->Cell(cellID);
coord = netIF->Center(cellRec);
if ((toCell = netIF->ToCell(cellRec)) == (DBObjRecord *) NULL) continue;
if (outIF->Value(outLayerRec, netIF->CellPosition(cellRec), &inValue) == false) continue;
if (outIF->Value(outLayerRec, netIF->CellPosition(toCell), &outValue) == false) continue;
sumWeights[toCell->RowID()] = sumWeights[toCell->RowID()] + weight;
if (coeffIF != (DBGridIF *) NULL) {
if (coeffIF->Value(coeffLayerRec, netIF->Center(cellRec), &kCoeff) == false) kCoeff = 1.0;
}
else {
if (((Q_IF == (DBGridIF *) NULL) || (Q_IF->Value(Q_LayerRec, netIF->Center(cellRec), &q) == false)) ||
((HL_IF == (DBGridIF *) NULL) ||
(HL_IF->Value(HL_LayerRec, netIF->Center(cellRec), &hl) == false)) ||
(umax == 0) || (ksat == 0))
//.........这里部分代码省略.........
示例8: RGISEditGridDateLayersCBK
//.........这里部分代码省略.........
XmNuserData, &timeStep,
NULL);
XmStringFree (string);
XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _RGISEditGridLayersYearButtonCBK,(XtPointer) DBTimeStepMinute);
string = XmStringCreate ((char *) "Time Step:",UICharSetBold);
menu = XtVaCreateManagedWidget ("RGISEditGridDateLayersTimeStepMenu",xmRowColumnWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_FORM,
XmNbottomOffset, 10,
XmNrowColumnType, XmMENU_OPTION,
XmNlabelString, string,
XmNsubMenuId, menu,
NULL);
XmStringFree (string);
yearTextF = XtVaCreateManagedWidget ("RGISEditGridDateLayersYearTextF",xmTextFieldWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, menu,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, menu,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, menu,
XmNmaxLength, 4,
XmNcolumns, 4,
NULL);
XtAddCallback (yearTextF,XmNvalueChangedCallback,(XtCallbackProc) _RGISEditGridLayersYearTextCBK,yearText);
string = XmStringCreate ((char *) "Begin Year",UICharSetBold);
XtVaCreateManagedWidget ("RGISEditGridDateLayersYearLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, menu,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, yearTextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, menu,
XmNlabelString, string,
NULL);
XmStringFree (string);
XtSetSensitive (UIDialogFormGetOkButton (dShell),true);
XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&proc);
}
proc = false;
UIDialogFormPopup (dShell);
while (UILoop ())
{ }
UIDialogFormPopdown (dShell);
if (proc)
{
DBInt layerID, year;
DBDate stepDate;
DBGridIF *gridIF = new DBGridIF (dbData);
DBObjRecord *layerRec;
DBDate date;
switch (timeStep)
{
case DBTimeStepYear: stepDate.Set (1); break;
case DBTimeStepMonth: stepDate.Set (0,1); break;
case DBTimeStepDay: stepDate.Set (0,0,1); break;
case DBTimeStepHour: stepDate.Set (0,0,0,1); break;
case DBTimeStepMinute: stepDate.Set (0,0,0,0,1); break;
}
if (sscanf (yearText,"%d",&year) != 1)
{
year = DBDefaultMissingIntVal;
if (((stepDate.Year () > 0) && (gridIF->LayerNum () > 1)) ||
((stepDate.Month () > 0) && (gridIF->LayerNum () > 12)) ||
((stepDate.Day () > 0) && (gridIF->LayerNum () > 365)) ||
((stepDate.Hour () > 0) && (gridIF->LayerNum () > 365 * 24)) ||
((stepDate.Minute () > 0) && (gridIF->LayerNum () > 365 * 24 * 60)))
{
UIMessage ((char *) "Too Many Layers in Dataset");
}
}
UIPauseDialogOpen ((char *) "Labeling Layers");
date.Set (year);
if (stepDate.Month () > 0) date.Set (year,0);
if (stepDate.Day () > 0) date.Set (year,0,0);
if (stepDate.Hour () > 0) date.Set (year,0,0,0);
if (stepDate.Minute () > 0) date.Set (year,0,0,0,0);
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
if (UIPause (layerRec->RowID () * 100 / gridIF->LayerNum ())) goto Stop;
gridIF->RenameLayer (layerRec,date.Get ());
date = date + stepDate;
}
Stop:
UIPauseDialogClose ();
delete gridIF;
}
}