本文整理汇总了C++中DBGridIF::Value方法的典型用法代码示例。如果您正苦于以下问题:C++ DBGridIF::Value方法的具体用法?C++ DBGridIF::Value怎么用?C++ DBGridIF::Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBGridIF
的用法示例。
在下文中一共展示了DBGridIF::Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DBGridOperationAbs
void DBGridOperationAbs(DBObjData *grdData) {
DBInt layerID;
DBFloat value;
DBPosition pos;
DBObjRecord *layerRec;
DBGridIF *gridIF = new DBGridIF(grdData);
for (layerID = 0; layerID < gridIF->LayerNum(); ++layerID) {
layerRec = gridIF->Layer(layerID);
if ((layerRec->Flags() & DBObjectFlagIdle) != DBObjectFlagIdle) break;
}
if (layerID == gridIF->LayerNum()) {
CMmsgPrint(CMmsgAppError, "No Layer to Process in %s %d", __FILE__, __LINE__);
return;
}
for (layerID = 0; layerID < gridIF->LayerNum(); ++layerID) {
layerRec = gridIF->Layer(layerID);
if ((layerRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
for (pos.Row = 0; pos.Row < gridIF->RowNum(); pos.Row++) {
if (DBPause((layerID * gridIF->RowNum() + pos.Row) * 100 / (gridIF->LayerNum() * gridIF->RowNum())))
goto Stop;
for (pos.Col = 0; pos.Col < gridIF->ColNum(); pos.Col++)
if (gridIF->Value(layerRec, pos, &value)) gridIF->Value(layerRec, pos, fabs(value));
}
gridIF->RecalcStats(layerRec);
}
Stop:
return;
}
示例2: DBGridOperation
void DBGridOperation(DBObjData *grdData, DBFloat constant, DBInt oper) {
DBInt layerID;
DBFloat value;
DBPosition pos;
DBObjRecord *layerRec;
DBGridIF *gridIF = new DBGridIF(grdData);
for (layerID = 0; layerID < gridIF->LayerNum(); ++layerID) {
layerRec = gridIF->Layer(layerID);
if ((layerRec->Flags() & DBObjectFlagIdle) != DBObjectFlagIdle) break;
}
if (layerID == gridIF->LayerNum()) {
CMmsgPrint(CMmsgAppError, "No Layer to Process in %s %d", __FILE__, __LINE__);
return;
}
for (layerID = 0; layerID < gridIF->LayerNum(); ++layerID) {
layerRec = gridIF->Layer(layerID);
if ((layerRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
for (pos.Row = 0; pos.Row < gridIF->RowNum(); pos.Row++) {
if (DBPause((layerID * gridIF->RowNum() + pos.Row) * 100 / (gridIF->LayerNum() * gridIF->RowNum())))
goto Stop;
for (pos.Col = 0; pos.Col < gridIF->ColNum(); pos.Col++) {
if (gridIF->Value(layerRec, pos, &value))
switch (oper) {
case DBMathOperatorAdd:
gridIF->Value(layerRec, pos, value + constant);
break;
case DBMathOperatorSub:
gridIF->Value(layerRec, pos, value - constant);
break;
case DBMathOperatorMul:
gridIF->Value(layerRec, pos, value * constant);
break;
case DBMathOperatorDiv:
gridIF->Value(layerRec, pos, value / constant);
break;
}
}
}
gridIF->RecalcStats(layerRec);
}
Stop:
return;
}
示例3: ComputeTask
void ComputeTask(DBObjRecord *record, size_t taskId) {
size_t i;
DBPosition pos;
DBCoordinate coord;
pos.Row = taskId / GridIF->ColNum();
pos.Col = taskId % GridIF->ColNum();
GridIF->Pos2Coord(pos, coord);
for (i = 0; i < VarNum; ++i) GrdVar[i]->GetVariable(record, coord);
for (i = 0; i < ExpNum; ++i) Expressions[i]->Evaluate(record);
GridIF->Value(LayerRec, pos, Operand->Float(record));
}
示例4: RGISEditLineDirectionCBK
void RGISEditLineDirectionCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
DBFloat elev0, elev1;
DBCoordinate coord;
DBObjRecord *lineRec;
DBDataset *dataset = UIDataset ();
DBObjData *lineData = dataset->Data ();
DBObjData *gridData = lineData->LinkedData ();
DBVLineIF *lineIF = new DBVLineIF (lineData);
DBGridIF *gridIF = new DBGridIF (gridData);
UIPauseDialogOpen ((char *) "Changing Directionality");
for (lineRec = lineIF->FirstItem ();lineRec != (DBObjRecord *) NULL;lineRec = lineIF->NextItem ())
{
DBPause (lineRec->RowID () * 100 / lineIF->ItemNum ());
coord = lineIF->FromCoord (lineRec);
if (gridIF->Value (coord,&elev0) == false) continue;
coord = lineIF->ToCoord (lineRec);
if (gridIF->Value (coord,&elev1) == false) continue;
if (elev0 < elev1) lineIF->Flip (lineRec);
}
UIPauseDialogClose ();
}
示例5: GetVariable
void GetVariable(DBObjRecord *record, DBCoordinate coord) {
switch ((GridIF->Data())->Type()) {
case DBTypeGridContinuous: {
DBFloat value;
if (GridIF->Value(LayerRec, coord, &value))
TargetFLD->Float(record, value);
else TargetFLD->Float(record, TargetFLD->FloatNoData());
}
break;
case DBTypeGridDiscrete: {
DBObjRecord *grdRec;
if ((grdRec = GridIF->GridItem(LayerRec, coord)) != (DBObjRecord *) NULL)
switch (SourceFLD->Type()) {
case DBVariableString:
TargetFLD->String(record, SourceFLD->String(grdRec));
break;
case DBVariableInt:
TargetFLD->Int(record, SourceFLD->Int(grdRec));
break;
case DBVariableFloat:
TargetFLD->Float(record, SourceFLD->Float(grdRec));
break;
default:
break;
}
else
switch (SourceFLD->Type()) {
case DBVariableString:
TargetFLD->String(record, "");
break;
case DBVariableInt:
TargetFLD->Int(record, SourceFLD->IntNoData());
break;
case DBVariableFloat:
TargetFLD->Float(record, SourceFLD->FloatNoData());
break;
default:
break;
}
}
break;
default:
CMmsgPrint(CMmsgUsrError, "Invalid grid type in: CMDgrdVariable:GetVariable ()");
break;
}
}
示例6: DBPointToGrid
DBInt DBPointToGrid(DBObjData *pntData, DBObjData *netData, DBObjData *grdData) {
DBInt i;
DBPosition pos;
DBObjTable *pntTable = pntData->Table(DBrNItems);
DBObjTable *grdTable = grdData->Table(DBrNItems);
DBObjTable *symTable = grdData->Table(DBrNSymbols);
DBObjectLIST<DBObjTableField> *pntFields = pntTable->Fields();
DBObjTableField *pntFLD;
DBObjTableField *grdAttribFLD;
DBObjTableField *grdFLD = grdTable->Field(DBrNGridValue);
DBObjTableField *symFLD = grdTable->Field(DBrNSymbol);
DBObjRecord *cellRec, *toCell, *pntRec, *itemRec;
DBObjRecord *symRec = symTable->First();
DBVPointIF *pntIF;
DBNetworkIF *netIF;
DBGridIF *grdIF;
pntIF = new DBVPointIF(pntData);
netIF = new DBNetworkIF(netData);
grdIF = new DBGridIF(grdData);
grdIF->RenameLayer(grdIF->Layer((DBInt) 0), (char *) "Subbasins");
for (pos.Row = 0; pos.Row < grdIF->RowNum(); ++pos.Row)
for (pos.Col = 0; pos.Col < grdIF->ColNum(); ++pos.Col) grdIF->Value(pos, DBFault);
for (pntFLD = pntFields->First(); pntFLD != (DBObjTableField *) NULL; pntFLD = pntFields->Next())
if (DBTableFieldIsVisible(pntFLD)) grdTable->AddField(new DBObjTableField(*pntFLD));
for (i = 0; i < pntIF->ItemNum(); ++i) {
DBPause(i * 100 / pntIF->ItemNum());
pntRec = pntIF->Item(i);
if ((pntRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
if ((cellRec = netIF->Cell(pntIF->Coordinate(pntRec))) == (DBObjRecord *) NULL) continue;
itemRec = grdTable->Add(pntRec->Name());
grdFLD->Int(itemRec, pntRec->RowID() + 1);
symFLD->Record(itemRec, symRec);
for (pntFLD = pntFields->First(); pntFLD != (DBObjTableField *) NULL; pntFLD = pntFields->Next())
if ((grdAttribFLD = grdTable->Field(pntFLD->Name())) != (DBObjTableField *) NULL)
switch (pntFLD->Type()) {
case DBTableFieldString:
grdAttribFLD->String(itemRec, pntFLD->String(pntRec));
break;
case DBTableFieldInt:
grdAttribFLD->Int(itemRec, pntFLD->Int(pntRec));
break;
case DBTableFieldFloat:
grdAttribFLD->Float(itemRec, pntFLD->Float(pntRec));
break;
case DBTableFieldDate:
grdAttribFLD->Date(itemRec, pntFLD->Date(pntRec));
break;
}
grdIF->Value(netIF->CellPosition(cellRec), itemRec->RowID());
}
for (i = 0; i < netIF->CellNum(); ++i) {
if ((cellRec = netIF->Cell(i)) == (DBObjRecord *) NULL) continue;
if ((itemRec = grdIF->GridItem(netIF->CellPosition(cellRec))) != (DBObjRecord *) NULL) continue;
if ((toCell = netIF->ToCell(cellRec)) == (DBObjRecord *) NULL) continue;
if ((itemRec = grdIF->GridItem(netIF->CellPosition(toCell))) != (DBObjRecord *) NULL)
grdIF->Value(netIF->CellPosition(cellRec), itemRec->RowID());
}
grdIF->DiscreteStats();
delete pntIF;
delete netIF;
delete grdIF;
return (DBSuccess);
}
示例7: RGPDrawGridContinuous
//.........这里部分代码省略.........
}
else if (RGPPrintError (mode,*entryNum,"Background Color Entry Error")) { ret = DBFault; goto Stop; }
} while (true);
do {
RGPPrintMessage (mode,entryNum,"Color Shade [red,green,blue]:");
if (fgets (charBuffer,sizeof (charBuffer) - 2,stdin) == (char *) NULL) { ret = DBFault; goto Stop; }
if (sscanf (charBuffer,"%d,%d,%d",&r,&g,&b) == 3)
{
if ((customColors = (RGPColorMapEntry *) realloc (customColors,(colorNum + 1) * sizeof (RGPColorMapEntry))) == (RGPColorMapEntry *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); delete gridIF; return (DBFault); }
customColors [colorNum].Red = r;
customColors [colorNum].Green = g;
customColors [colorNum].Blue = b;
colorNum++;
}
else
{
if (colorNum < 3)
{ if (RGPPrintError (mode,*entryNum,"Color Shade Entry Error")) { ret = DBFault; goto Stop; }}
else break;
}
} while (true);
shadeNum = RGPSetColorMap (customColors,colorNum);
free (customColors);
break;
}
if (shadeNum == DBFault) { RGPPrintError (mode,*entryNum,"Colormap Initialization Error") ; ret = DBFault; goto Stop; }
do {
RGPPrintMessage (mode,entryNum,"Scale mode [linear|logarithmic]:");
if (fgets (charBuffer,sizeof (charBuffer) - 2,stdin) == (char *) NULL) { ret = DBFault; goto Stop; }
if ((strlen (charBuffer) > 0) && (charBuffer [strlen (charBuffer) - 1] == '\n'))
charBuffer [strlen (charBuffer) - 1] = '\0';
if ((scaleMode = CMoptLookup (scaleModes,charBuffer,true)) != DBFault) break;
sprintf (errorMsg,"Invalid scale mode [%s]",charBuffer);
if (RGPPrintError (mode,*entryNum,errorMsg)) { ret = DBFault; goto Stop; }
} while (true);
do {
RGPPrintMessage (mode,entryNum,"Value range [minimum,maximum]:");
if (fgets (charBuffer,sizeof (charBuffer) - 2,stdin) == (char *) NULL) { ret = DBFault; goto Stop; }
if (sscanf (charBuffer,"%f,%f",&min,&max) == 2) break;
else if (RGPPrintError (mode,*entryNum,"Value range input error")) { ret = DBFault; goto Stop; }
} while (true);
if ((array = (float *) calloc (gridIF->RowNum () * gridIF->ColNum (),sizeof (float))) == (float *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory allocation error in: %s %d",__FILE__,__LINE__); ret = DBFault; goto Stop; }
for (pos.Row = 0;pos.Row < gridIF->RowNum ();++pos.Row)
for (pos.Col = 0;pos.Col < gridIF->ColNum ();++pos.Col)
if (gridIF->Value (layerRec,pos,&value))
{
value = value > min ? value : min;
value = value < max ? value : max;
switch (scaleMode)
{
default:
case 0: array [pos.Row * gridIF->ColNum () + pos.Col] = value; break;
case 1: array [pos.Row * gridIF->ColNum () + pos.Col] = log10 (value); break;
case 2: array [pos.Row * gridIF->ColNum () + pos.Col] = sqrt (value); break;
}
}
else array [pos.Row * gridIF->ColNum () + pos.Col] = min - (max - min) / (float) shadeNum;
translation [0] = extent.LowerLeft.X - gridIF->CellWidth () / 2.0;
translation [1] = gridIF->CellWidth ();
translation [2] = 0.0;
translation [3] = extent.LowerLeft.Y - gridIF->CellHeight () / 2.0;
translation [4] = 0.0;
translation [5] = gridIF->CellHeight ();
RGPPrintMessage (mode,entryNum,"Unit:");
if ((fgets (charBuffer,sizeof (charBuffer) - 2,stdin) == (char *) NULL) || (sscanf (charBuffer,"%f",&unit) != 1))
{ RGPPrintError (mode,*entryNum,"Unit input error"), ret = DBFault; goto Stop; }
RGPPrintMessage (mode,entryNum,"Unit label:");
if (fgets (charBuffer,sizeof (charBuffer) - 2,stdin) == (char *) NULL)
{ RGPPrintError (mode,*entryNum,"Unit label input error"); ret = DBFault; goto Stop; }
if ((strlen (charBuffer) > 0) && (charBuffer [strlen (charBuffer) - 1] == '\n'))
charBuffer [strlen (charBuffer) - 1] = '\0';
/* cpgsitf (scaleMode); */
switch (scaleMode)
{
default:
case 0:
min = min - (max - min) / (float) shadeNum;
max = max + (max - min) / (float) shadeNum;
cpgwedg ("BI",0.0,5.0,min * unit,max * unit,charBuffer);
cpgimag (array,pos.Col,pos.Row,1,pos.Col,1,pos.Row,min,max,translation);
break;
case 1:
cpgwedg ("BI",0.0,5.0,log10 (min * unit),log10 (max * unit),charBuffer);
cpgimag (array,pos.Col,pos.Row,1,pos.Col,1,pos.Row,log10 (min),log10 (max),translation);
break;
case 2:
cpgwedg ("BI",0.0,5.0,sqrt (min * unit),sqrt (max * unit),charBuffer);
cpgimag (array,pos.Col,pos.Row,1,pos.Col,1,pos.Row,sqrt (min),sqrt (max),translation);
break;
}
Stop:
delete gridIF;
return (ret);
}
示例8: _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))
//.........这里部分代码省略.........
示例9: RGISAnalyseLineMSampleGridCBK
void RGISAnalyseLineMSampleGridCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
DBInt layerID, layerNum;
DBCoordinate coord;
DBFloat realValue;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data ();
DBObjData *grdData = dbData->LinkedData ();
DBObjData *tblData;
DBObjTable *table, *itemTable = dbData->Table (DBrNItems);
DBObjTableField *lineIDFLD;
DBObjTableField *layerIDFLD;
DBObjTableField *layerNameFLD;
DBObjTableField *fromValueFLD = (DBObjTableField *) NULL;
DBObjTableField *toValueFLD = (DBObjTableField *) NULL;
DBVLineIF *lineIF = (DBVLineIF *) NULL;
DBGridIF *gridIF;
DBObjRecord *record, *layerRec, *tblRec;
DBObjectLIST<DBObjTableField> *fields;
widget = widget; callData = callData;
gridIF = new DBGridIF (grdData);
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
if ((layerRec->Flags () & DBObjectFlagIdle) != DBObjectFlagIdle) ++layerNum;
}
if (layerNum < 1)
{ CMmsgPrint (CMmsgAppError, "No Layer to Process in: %s %d",__FILE__,__LINE__); delete gridIF; return; }
tblData = new DBObjData ("",DBTypeTable);
tblData->Document (DBDocGeoDomain,dbData->Document (DBDocGeoDomain));
tblData->Document (DBDocSubject,grdData->Document (DBDocSubject));
if (UIDataHeaderForm (tblData) == false) { delete gridIF; delete tblData; return; }
table = tblData->Table (DBrNItems);
lineIF = new DBVLineIF (dbData);
table->AddField (lineIDFLD = new DBObjTableField ("GHAASPointID",DBTableFieldInt, "%8d",sizeof (DBInt)));
table->AddField (layerIDFLD = new DBObjTableField ("LayerID", DBTableFieldInt, "%4d",sizeof (DBShort)));
table->AddField (layerNameFLD = new DBObjTableField ("LayerName", DBTableFieldString,"%s",DBStringLength));
table->AddField (fromValueFLD = new DBObjTableField (RGISLineFromNodeValue,DBTableFieldFloat,gridIF->ValueFormat (),sizeof (DBFloat4)));
table->AddField (toValueFLD = new DBObjTableField (RGISLineToNodeValue,DBTableFieldFloat,gridIF->ValueFormat (),sizeof (DBFloat4)));
grdData->Flags (DBObjectFlagProcessed,DBSet);
UIPauseDialogOpen ((char *) "Sampling Grid(s)");
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
if ((layerRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
for (record = itemTable->First ();record != (DBObjRecord *) NULL;record = itemTable->Next ())
{
if (UIPause ((layerRec->RowID () * itemTable->ItemNum () + record->RowID ()) * 100 / (itemTable->ItemNum () * gridIF->LayerNum ()))) goto Stop;
if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
tblRec = table->Add (record->Name ());
lineIDFLD->Int (tblRec,record->RowID () + 1);
layerIDFLD->Int (tblRec,layerRec->RowID ());
layerNameFLD->String (tblRec,layerRec->Name ());
coord = lineIF->FromCoord (record);
if (gridIF->Value (layerRec,coord,&realValue))
fromValueFLD->Float (tblRec,realValue);
coord = lineIF->ToCoord (record);
if (gridIF->Value (layerRec,coord,&realValue))
toValueFLD->Float (tblRec,realValue);
}
}
Stop:
UIPauseDialogClose ();
delete gridIF;
delete lineIF;
fields = new DBObjectLIST<DBObjTableField> ("Field List");
fields->Add (new DBObjTableField (*lineIDFLD));
fields->Add (new DBObjTableField (*layerIDFLD));
table->ListSort (fields);
workspace->CurrentData (tblData);
delete fields;
}
示例10: DBObjData
DBObjData *DBNetworkToGrid(DBObjData *netData, DBInt type) {
DBPosition pos;
DBObjData *grdData = new DBObjData("", type);
DBObjRecord *layerRec, *dataRec;
DBObjTable *layerTable = grdData->Table(DBrNLayers);
DBObjTable *itemTable = grdData->Table(DBrNItems);
DBObjTableField *rowNumFLD = layerTable->Field(DBrNRowNum);
DBObjTableField *colNumFLD = layerTable->Field(DBrNColNum);
DBObjTableField *cellWidthFLD = layerTable->Field(DBrNCellWidth);
DBObjTableField *cellHeightFLD = layerTable->Field(DBrNCellHeight);
DBObjTableField *valueTypeFLD = layerTable->Field(DBrNValueType);
DBObjTableField *valueSizeFLD = layerTable->Field(DBrNValueSize);
DBObjTableField *layerFLD = layerTable->Field(DBrNLayer);
DBNetworkIF *netIF;
DBGridIF *gridIF;
grdData->Projection(netData->Projection());
grdData->Precision(netData->Precision());
grdData->MaxScale(netData->MaxScale());
grdData->MinScale(netData->MinScale());
grdData->Extent(netData->Extent());
grdData->Document(DBDocGeoDomain, netData->Document(DBDocGeoDomain));
netIF = new DBNetworkIF(netData);
layerTable->Add("FirstLayer");
if ((layerRec = layerTable->Item()) == (DBObjRecord *) NULL) {
delete netIF;
return ((DBObjData *) NULL);
}
rowNumFLD->Int(layerRec, netIF->RowNum());
colNumFLD->Int(layerRec, netIF->ColNum());
cellWidthFLD->Float(layerRec, netIF->CellWidth());
cellHeightFLD->Float(layerRec, netIF->CellHeight());
switch (type) {
case DBTypeGridContinuous:
valueTypeFLD->Int(layerRec, DBTableFieldFloat);
valueSizeFLD->Int(layerRec, sizeof(DBFloat));
break;
case DBTypeGridDiscrete:
valueTypeFLD->Int(layerRec, DBTableFieldInt);
valueSizeFLD->Int(layerRec, sizeof(DBInt));
break;
default:
CMmsgPrint(CMmsgAppError, "Invalid Data Type in: %s %d", __FILE__, __LINE__);
delete grdData;
delete netIF;
return ((DBObjData *) NULL);
}
if ((dataRec = new DBObjRecord(layerRec->Name(),
((size_t) netIF->ColNum()) * netIF->RowNum() * valueSizeFLD->Int(layerRec),
valueSizeFLD->Int(layerRec))) == (DBObjRecord *) NULL) {
delete netIF;
return ((DBObjData *) NULL);
}
(grdData->Arrays())->Add(dataRec);
layerFLD->Record(layerRec, dataRec);
gridIF = new DBGridIF(grdData);
if (type == DBTypeGridContinuous) {
itemTable->Add(layerRec->Name());
DBObjTableField *missingValueFLD = itemTable->Field(DBrNMissingValue);
missingValueFLD->Float(itemTable->Item(layerRec->Name()), DBDefaultMissingFloatVal);
for (pos.Row = 0; pos.Row < netIF->RowNum(); pos.Row++)
for (pos.Col = 0; pos.Col < netIF->ColNum(); pos.Col++)
gridIF->Value(layerRec, pos, DBDefaultMissingFloatVal);
}
else {
DBObjTable *symbolTable = grdData->Table(DBrNSymbols);
DBObjTableField *foregroundFLD = symbolTable->Field(DBrNForeground);
DBObjTableField *backgroundFLD = symbolTable->Field(DBrNBackground);
DBObjTableField *styleFLD = symbolTable->Field(DBrNStyle);
DBObjRecord *symbolRec = symbolTable->Add("Default Symbol");
foregroundFLD->Int(symbolRec, 1);
backgroundFLD->Int(symbolRec, 0);
styleFLD->Int(symbolRec, 0);
for (pos.Row = 0; pos.Row < netIF->RowNum(); pos.Row++)
for (pos.Col = 0; pos.Col < netIF->ColNum(); pos.Col++)
gridIF->Value(layerRec, pos, 0);
}
delete netIF;
delete gridIF;
return (grdData);
}
示例11: Write
DBInt Write (FILE *file,DBObjData *data)
{
char *dmRecord;
DBInt layerID, docLen, dbType, intVal;
DBFloat floatVal;
DBPosition pos;
DBObjRecord *layerRec;
DBGridIF *gridIF = new DBGridIF (data);
DMLayerHeader dmLayerHeader;
dbType = gridIF->ValueType ();
switch (dbType)
{
case DBTableFieldFloat: DataType (DMFloat); break;
case DBTableFieldInt:
DataType (gridIF->ValueSize () > 1 ? DMInt : DMByte); break;
}
CellWidth (gridIF->CellWidth ());
CellHeight (gridIF->CellHeight ());
Extent (data->Extent ());
LayerNum (gridIF->LayerNum ());
RowNum (gridIF->RowNum ());
ColNum (gridIF->ColNum ());
dmRecord = (char *) calloc (RowNum () * ColNum (),DataType () != DMByte ? sizeof (int) : sizeof (char));
if (dmRecord == (char *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
DMFileHeader::Write (file);
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
dmLayerHeader.Description (layerRec->Name ());
dmLayerHeader.Write (file);
}
docLen = strlen (data->Document (DBDocComment));
if (fwrite (&docLen,sizeof (int),1,file) != 1)
{ CMmsgPrint (CMmsgSysError, "File Writing Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (docLen > 0)
{
if (fwrite (data->Document (DBDocComment),docLen,1,file) != 1)
{ CMmsgPrint (CMmsgSysError, "File Writing Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
}
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
switch (data->Type ())
{
case DBTypeGridContinuous:
layerRec = gridIF->Layer (layerID);
if (dbType == DBTableFieldFloat)
{
for (pos.Row = 0;pos.Row < RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < ColNum ();pos.Col++)
if (gridIF->Value (layerRec,pos,&floatVal))
((float *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = (float) floatVal;
else
((float *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = MissingValue ();
}
else
{
for (pos.Row = 0;pos.Row < RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < ColNum ();pos.Col++)
if (gridIF->Value (layerRec,pos,&intVal))
{
if (DataType () == DMInt)
((int *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = (int) intVal;
else
dmRecord [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = intVal;
}
else
{
if (DataType () == DMInt)
((int *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = (int) MissingValue ();
else
dmRecord [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = -99;
}
}
break;
case DBTypeGridDiscrete:
for (pos.Row = 0;pos.Row < RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < ColNum ();pos.Col++)
{
intVal = gridIF->GridValue (layerRec,pos);
if (DataType () == DMInt)
((int *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = intVal;
else
dmRecord [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = -99;
}
break;
default:
CMmsgPrint (CMmsgAppError, "Invalid Data Type in: %s %d",__FILE__,__LINE__);
free (dmRecord);
delete gridIF;
return (DBFault);
}
if ((DBInt) fwrite (dmRecord,DataType () == DMByte ? sizeof (char) : sizeof (int),DataPointNum (),file) != DataPointNum ())
{ CMmsgPrint (CMmsgSysError, "File Writing Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
}
//.........这里部分代码省略.........
示例12: 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);
}
示例13: DBGridCont2Network
DBInt DBGridCont2Network (DBObjData *gridData,DBObjData *netData, bool downhill)
{
DBInt basinID, layerID, zLayerID, zLayerNum, dir, maxDir, projection = gridData->Projection (), *zones;
DBFloat elev0, elev1, delta, maxDelta, distance;
DBCoordinate coord0, coord1;
DBInt row, col;
DBPosition pos, auxPos;
char nameSTR [DBStringLength];
DBObjTable *basinTable = netData->Table (DBrNItems);
DBObjTable *cellTable = netData->Table (DBrNCells);
DBObjTable *layerTable = netData->Table (DBrNLayers);
DBObjRecord *layerRec, *dataRec, *cellRec, *basinRec;
DBObjTableField *mouthPosFLD = basinTable->Field (DBrNMouthPos);
DBObjTableField *colorFLD = basinTable->Field (DBrNColor);
DBObjTableField *positionFLD = cellTable->Field (DBrNPosition);
DBObjTableField *toCellFLD = cellTable->Field (DBrNToCell);
DBObjTableField *fromCellFLD = cellTable->Field (DBrNFromCell);
DBObjTableField *orderFLD = cellTable->Field (DBrNOrder);
DBObjTableField *basinFLD = cellTable->Field (DBrNBasin);
DBObjTableField *basinCellsFLD= cellTable->Field (DBrNBasinCells);
DBObjTableField *travelFLD = cellTable->Field (DBrNTravel);
DBObjTableField *upCellPosFLD = cellTable->Field (DBrNUpCellPos);
DBObjTableField *cellAreaFLD = cellTable->Field (DBrNCellArea);
DBObjTableField *subbasinLengthFLD = cellTable->Field (DBrNSubbasinLength);
DBObjTableField *subbasinAreaFLD = cellTable->Field (DBrNSubbasinArea);
DBObjTableField *rowNumFLD = layerTable->Field (DBrNRowNum);
DBObjTableField *colNumFLD = layerTable->Field (DBrNColNum);
DBObjTableField *cellWidthFLD = layerTable->Field (DBrNCellWidth);
DBObjTableField *cellHeightFLD = layerTable->Field (DBrNCellHeight);
DBObjTableField *valueTypeFLD = layerTable->Field (DBrNValueType);
DBObjTableField *valueSizeFLD = layerTable->Field (DBrNValueSize);
DBObjTableField *layerFLD = layerTable->Field (DBrNLayer);
DBObjData *zGridData = gridData->LinkedData ();
DBGridIF *gridIF = new DBGridIF (gridData), *zGridIF;
DBNetworkIF *netIF;
if ((zGridData != (DBObjData *) NULL) && ((zGridData->Type () == DBTypeGridDiscrete) || (zGridData->Type () == DBTypeGridContinuous)))
{
zGridIF = new DBGridIF (zGridData);
zLayerNum = zGridIF->LayerNum () + 1;
}
else { zGridIF = (DBGridIF *) NULL; zLayerNum = 1; }
if ((zones = (DBInt *) calloc (9 * zLayerNum,sizeof (DBInt))) == (DBInt *) NULL)
{
CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__);
if (zGridIF != (DBGridIF *) NULL) delete zGridIF;
delete gridIF;
return (DBFault);
}
layerTable->Add (DBrNLookupGrid);
if ((layerRec = layerTable->Item (DBrNLookupGrid)) == (DBObjRecord *) NULL)
{
free (zones);
if (zGridIF != (DBGridIF *) NULL) delete zGridIF;
delete gridIF;
return (DBFault);
}
netData->Projection (projection);
netData->Extent (gridData->Extent ());
cellWidthFLD->Float (layerRec,gridIF->CellWidth ());
cellHeightFLD->Float (layerRec,gridIF->CellHeight ());
valueTypeFLD->Int (layerRec,DBTableFieldInt);
valueSizeFLD->Int (layerRec,sizeof (DBInt));
rowNumFLD->Int (layerRec,gridIF->RowNum ());
colNumFLD->Int (layerRec,gridIF->ColNum ());
dataRec = new DBObjRecord ("NetLookupGridRecord",((size_t) gridIF->RowNum ()) * gridIF->ColNum () * sizeof (DBInt),sizeof (DBInt));
if (dataRec == (DBObjRecord *) NULL)
{
if (zGridIF != (DBGridIF *) NULL) delete zGridIF;
return (DBFault);
}
layerFLD->Record (layerRec,dataRec);
(netData->Arrays ())->Add (dataRec);
for (pos.Row = 0;pos.Row < gridIF->RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < gridIF->ColNum ();pos.Col++)
((DBInt *) dataRec->Data ()) [pos.Row * gridIF->ColNum () + pos.Col] = DBFault;
for (pos.Row = 0;pos.Row < gridIF->RowNum ();pos.Row++)
{
if (DBPause (10 * pos.Row / gridIF->RowNum ())) goto PauseStop;
for (pos.Col = 0;pos.Col < gridIF->ColNum ();pos.Col++)
{
gridIF->Pos2Coord (pos,coord0);
zLayerID = 0;
if (zGridIF != (DBGridIF *) NULL)
for ( ; zLayerID < zGridIF->LayerNum (); zLayerID++)
{
layerRec = zGridIF->Layer (zLayerID);
if ((layerRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
for (dir = 0;dir < 8;++dir)
{
row = pos.Row;
col = pos.Col;
//.........这里部分代码省略.........
示例14: RGlibRGIS2DataStream
DBInt RGlibRGIS2DataStream(DBObjData *grdData, DBObjData *tmplData, char *fieldName, FILE *outFile) {
DBInt layerID, ret = DBSuccess, itemSize, itemID;
DBInt intValue;
DBFloat floatValue;
void *data;
MFVarHeader_t varHeader;
DBObjRecord *layerRec, *gridRec;
DBObjTableField *fieldPTR = (DBObjTableField *) NULL;
DBGridIF *gridIF;
DBVPointIF *tmplPntIF = (DBVPointIF *) NULL;
DBGridIF *tmplGrdIF = (DBGridIF *) NULL;
DBNetworkIF *tmplNetIF = (DBNetworkIF *) NULL;
gridIF = new DBGridIF(grdData);
varHeader.Swap = 1;
if (grdData->Type() == DBTypeGridDiscrete) {
DBObjTable *itemTable = grdData->Table(DBrNItems);
if (fieldName == (char *) NULL) fieldName = DBrNGridValue;
if ((fieldPTR = itemTable->Field(fieldName)) == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgAppError, "Error: Invalid field [%s] in: %s %d", fieldName, __FILE__, __LINE__);
return (DBFault);
}
itemSize = fieldPTR->Length();
switch (fieldPTR->Type()) {
case DBTableFieldInt:
switch (itemSize) {
default:
case sizeof(DBByte):
varHeader.DataType = MFByte;
break;
case sizeof(DBShort):
varHeader.DataType = MFShort;
break;
case sizeof(DBInt):
varHeader.DataType = MFInt;
break;
}
varHeader.Missing.Int = fieldPTR->IntNoData();
break;
case DBTableFieldFloat:
switch (itemSize) {
default:
case sizeof(DBFloat4):
varHeader.DataType = MFFloat;
break;
case sizeof(DBFloat):
varHeader.DataType = MFDouble;
break;
}
varHeader.Missing.Float = fieldPTR->FloatNoData();
break;
}
}
else {
if (fieldName != (char *) NULL) CMmsgPrint(CMmsgUsrError, "Warning: Fieldname ignored for continuous grid!");
itemSize = gridIF->ValueSize();
switch (gridIF->ValueType()) {
case DBVariableInt:
switch (itemSize) {
case 1:
varHeader.DataType = MFByte;
break;
case 2:
varHeader.DataType = MFShort;
break;
case 4:
varHeader.DataType = MFInt;
break;
}
varHeader.Missing.Int = (int) gridIF->MissingValue();
break;
case DBVariableFloat:
switch (itemSize) {
case 4:
varHeader.DataType = MFFloat;
break;
case 8:
varHeader.DataType = MFDouble;
break;
}
varHeader.Missing.Float = gridIF->MissingValue();
break;
}
}
if (tmplData == (DBObjData *) NULL) {
tmplGrdIF = gridIF;
varHeader.ItemNum = gridIF->RowNum() * gridIF->ColNum();
}
else {
switch (tmplData->Type()) {
case DBTypeVectorPoint:
tmplPntIF = new DBVPointIF(tmplData);
varHeader.ItemNum = tmplPntIF->ItemNum();
break;
case DBTypeGridContinuous:
case DBTypeGridDiscrete:
tmplGrdIF = new DBGridIF(tmplData);
//.........这里部分代码省略.........
示例15: _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);
}