本文整理汇总了C++中DBObjectLIST::Item方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjectLIST::Item方法的具体用法?C++ DBObjectLIST::Item怎么用?C++ DBObjectLIST::Item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjectLIST
的用法示例。
在下文中一共展示了DBObjectLIST::Item方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
int i, verbose = false;
char *ghaasMetaDB = (char *) NULL, metaFileName[DBDataFileNameLen];
DBObjData *dbData;
DBDataset *dbDataset;
DBObjectLIST<DBObjMetaEntry> *metaList;
DBObjMetaEntry *metaEntry;
if (argc < 2) {
Usage(argv[0]);
return (0);
}
for (i = 1; i < argc; ++i) {
if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
Usage(argv[0]);
return (0);
}
else if ((strcmp(argv[i], "-V") == 0) || (strcmp(argv[i], "--verbose") == 0)) verbose = true;
else if (((strcmp(argv[i], "-m") == 0) || (strcmp(argv[i], "--MetaDB") == 0)) && (argc > i + 1)) {
if (++i < argc) {
ghaasMetaDB = argv[i];
break;
} else {
Usage(argv[0]);
return (0);
}
}
}
if (i == argc) i = 0;
if (verbose) RGlibPauseOpen(argv[0]);
if (ghaasMetaDB == (char *) NULL) {
sprintf(metaFileName, "%s/GHAASMetadb", getenv("GHAAS_DIR") == NULL ? getenv("HOME") : getenv("GHAAS_DIR"));
ghaasMetaDB = metaFileName;
}
dbDataset = new DBDataset((char *) "GHAASmetadb", ghaasMetaDB);
metaList = dbDataset->MetaList();
for (; i < argc - 1; ++i) {
dbData = new DBObjData();
if (dbData->Read(argv[i + 1]) == DBSuccess) {
dbData->FileName(argv[i + 1]);
dbDataset->Data(dbData);
printf("%s\n", dbData->Name());
metaEntry = metaList->Item(dbData->Name());
metaEntry->FileName(dbData->FileName());
dbDataset->RemoveData(dbData);
}
delete dbData;
}
delete dbDataset;
if (verbose) RGlibPauseClose();
return (0);
}
示例2: _RGISGridGroupListCBK
static void _RGISGridGroupListCBK (Widget widget,RGISGrpPanel *grpPanel, XmListCallbackStruct *callData)
{
DBObjData *data;
DBObjTable *groupTable;
DBObjectLIST<DBObjTableField> *groups;
DBObjTableField *group = (DBObjTableField *) NULL;
XtVaGetValues (widget,XmNuserData, &data, NULL);
if (data == (DBObjData *) NULL) return;
if ((groupTable = data->Table (DBrNGroups)) != (DBObjTable *) NULL)
{
groups = groupTable->Fields ();
if ((group = groups->Item (callData->item_position - 1)) != (DBObjTableField *) NULL)
grpPanel->Current (group);
}
}
示例3: Configure
CMreturn Configure(bool shrink, bool flat, char *expStr) {
size_t i;
DBInt recID, layerID;
DBFloat floatVal;
DBObject *obj;
DBObjTableField *fieldPTR;
Operand = new DBMathOperand(expStr);
if (Operand->Expand(Variables) == DBFault) return (CMfailed);
CellSize.X = CellSize.Y = DBHugeVal;
for (recID = 0; recID < Variables->ItemNum(); ++recID) {
obj = Variables->Item(recID);
if ((fieldPTR = Table->Field(obj->Name())) != (DBObjTableField *) NULL) continue;
if ((GrdVar = (CMDgrdVariable **) realloc(GrdVar, sizeof(CMDgrdVariable *) * (VarNum + 1))) ==
(CMDgrdVariable **) NULL) {
CMmsgPrint(CMmsgSysError, "Memory Allocation Error in: %s %d", __FILE__, __LINE__);
return (CMfailed);
}
GrdVar[VarNum] = new CMDgrdVariable(obj->Name());
if (GrdVar[VarNum]->Configure(Table, flat) == DBFault) {
for (i = 0; i <= VarNum; ++i) delete GrdVar[i];
free(GrdVar);
return (CMfailed);
}
Extent.Expand(GrdVar[VarNum]->Extent());
floatVal = GrdVar[VarNum]->CellWidth();
if (CellSize.X > floatVal) CellSize.X = floatVal;
floatVal = GrdVar[VarNum]->CellHeight();
if (CellSize.Y > floatVal) CellSize.Y = floatVal;
layerID = (GrdVar[VarNum])->LayerNum();
if (LayerNum < layerID) {
LayerNum = layerID;
MasterVar = VarNum;
}
VarNum++;
}
for (i = 0; i < ExpNum; ++i) if (Expressions[i]->Configure(Table) == DBFault) return (CMfailed);
Operand->Configure(Table->Fields());
if (shrink) for (i = 0; i < VarNum; ++i) Extent.Shrink(GrdVar[i]->Extent());
return (CMsucceeded);
}
示例4: Vertexes
void DBVLineIF::Vertexes (DBObjRecord *lineRec,DBCoordinate *coord,DBInt vertexNum)
{
DBInt vertex;
DBFloat length = 0;
DBCoordinate *vertexes, prevCoord;
DBObjRecord *dataRec = (DBObjRecord *) NULL;
DBObjectLIST<DBObjRecord> *dataArrays = Data ()->Arrays ();
DBRegion lineExtent, dataExtent = Data ()->Extent ();
DBMathDistanceFunction distFunc = DBMathGetDistanceFunction (Data ());
prevCoord = NodeCoordFLD->Coordinate (FromNodeFLD->Record (lineRec));
lineExtent.Expand (prevCoord);
if (vertexNum > 0)
{
if ((dataRec = dataArrays->Item (lineRec->RowID ())) == (DBObjRecord *) NULL)
{
if ((dataRec = new DBObjRecord (lineRec->Name (),((size_t) vertexNum) * sizeof (DBCoordinate),sizeof (DBFloat))) == (DBObjRecord *) NULL) return;
dataArrays->Add (dataRec);
}
else dataRec->Realloc (vertexNum * sizeof (DBCoordinate));
if ((vertexes = (DBCoordinate *) dataRec->Data ()) == NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return; }
for (vertex = 0;vertex < vertexNum;vertex++)
{
lineExtent.Expand (vertexes [vertex] = coord [vertex]);
length += DBMathCoordinateDistance (distFunc,prevCoord,coord [vertex]);
prevCoord = coord [vertex];
}
}
VertexesFLD->Record (lineRec,dataRec);
VertexNumFLD->Int (lineRec,vertexNum);
length += DBMathCoordinateDistance (distFunc,prevCoord,NodeCoordFLD->Coordinate (ToNodeFLD->Record (lineRec)));
PerimeterFLD->Float (lineRec,length);
lineExtent.Expand (NodeCoordFLD->Coordinate (ToNodeFLD->Record (lineRec)));
ExtentFLD->Region (lineRec,lineExtent);
dataExtent.Expand (lineExtent);
Data ()->Extent (dataExtent);
}
示例5: DBImportARCLine
int DBImportARCLine (DBObjData *vecData,const char *arcCov)
{
FILE *inFile;
DBInt arcNum, vertex, swap = DBByteOrder (DBByteOrderLITTLE), floatCov;
char fileName [DBDataFileNameLen], objName [DBStringLength];
short infoHeader [50];
DBARCRecord arcRecord;
DBObjTable *lines;
DBObjTable *nodes;
DBObjectLIST<DBObjRecord> *data;
DBObjRecord *lineRec, *nodeRec, *dataRec;
DBRegion dataExtent = vecData->Extent (), itemExtent;
DBObjTableField *fromNodeFLD;
DBObjTableField *toNodeFLD;
DBObjTableField *leftPolyFLD;
DBObjTableField *rightPolyFLD;
DBObjTableField *vertexesFLD;
DBObjTableField *vertexNumFLD;
DBObjTableField *extentFLD;
DBObjTableField *coordFLD;
DBObjTableField *linkNumFLD;
DBCoordinate *vertexes, nodeCoord;
DBFloat4 floatVAR [2];
switch (vecData->Type ())
{
case DBTypeVectorLine: lines = vecData->Table (DBrNItems); break;
case DBTypeVectorPolygon: lines = vecData->Table (DBrNContours); break;
default: CMmsgPrint (CMmsgAppError, "Invalide Vector Data Type in: %s %d",__FILE__,__LINE__); return (DBFault);
}
fromNodeFLD = lines->Field (DBrNFromNode);
toNodeFLD = lines->Field (DBrNToNode);
leftPolyFLD = lines->Field (DBrNLeftPoly);
rightPolyFLD= lines->Field (DBrNRightPoly);
vertexesFLD = lines->Field (DBrNVertexes);
vertexNumFLD= lines->Field (DBrNVertexNum);
extentFLD = lines->Field (DBrNRegion);
nodes = vecData->Table (DBrNNodes);
coordFLD = nodes->Field (DBrNCoord);
linkNumFLD = nodes->Field (DBrNLinkNum);
data = vecData->Arrays ();
sprintf (fileName,"%s/arc",arcCov);
if (access (fileName,R_OK) == DBFault) sprintf (fileName,"%s/arc.adf",arcCov);
if ((inFile = fopen (fileName,"r")) == NULL)
{ CMmsgPrint (CMmsgSysError, "File Opening Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (fread (infoHeader,sizeof (short),50,inFile) != 50)
{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
arcNum = 0;
for (lineRec = lines->First ();arcRecord.Read (inFile,swap) != DBFault;lineRec = lines->Next ())
{
if (lineRec == NULL)
{
sprintf (objName,"Line: %5d",arcRecord.ID () + 1);
if ((lineRec = lines->Add (objName)) == (DBObjRecord *) NULL) return (DBFault);
}
else DBPause ((++arcNum * 100) / lines->ItemNum ());
floatCov = arcRecord.RecordLength () - 12 == arcRecord.NumOfPnts () * (DBInt) sizeof (float) ? true : false;
while (arcRecord.FromNode () > nodes->ItemNum ())
{
sprintf (objName,"Node: %5d",nodes->ItemNum () + 1);
nodes->Add (objName);
if ((nodeRec = nodes->Item ()) == NULL) return (DBFault);
linkNumFLD->Int (nodeRec,0);
}
if ((nodeRec = nodes->Item (arcRecord.FromNode () - 1)) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Node Not Found in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (floatCov)
{
if (fread (floatVAR,sizeof (floatVAR),1,inFile) != 1)
{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (swap) { DBByteOrderSwapWord (floatVAR); DBByteOrderSwapWord (floatVAR + 1); }
nodeCoord.X = (DBFloat) floatVAR [0];
nodeCoord.Y = (DBFloat) floatVAR [1];
}
else
{
if (fread (&nodeCoord,sizeof (DBCoordinate),1,inFile) != 1)
{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (swap) nodeCoord.Swap ();
}
coordFLD->Coordinate (nodeRec,nodeCoord);
fromNodeFLD->Record (lineRec,nodeRec);
if (leftPolyFLD != (DBObjTableField *) NULL) leftPolyFLD->Record (lineRec,arcRecord.LeftPoly ());
if (rightPolyFLD != (DBObjTableField *) NULL) rightPolyFLD->Record (lineRec,arcRecord.RightPoly ());
itemExtent.LowerLeft = nodeCoord;
itemExtent.UpperRight = nodeCoord;
linkNumFLD->Int (nodeRec,linkNumFLD->Int (nodeRec) + 1);
if (arcRecord.NumOfPnts () > 2)
{
if ((dataRec = data->Item (lineRec->RowID ())) == (DBObjRecord *) NULL)
{
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
for (argPos = 1;argPos < argNum; )
{
if (CMargTest (argv [argPos],"-m","--metadb"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
{ CMmsgPrint (CMmsgUsrError, "Missing metadb argument!"); return (CMfailed); }
metaDB = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-p","--progress"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing progress mode!"); return (CMfailed); }
if ((progress = CMoptLookup (modes,argv [argPos],true)) == DBFault)
{ CMmsgPrint (CMmsgUsrError,"Invalid progress mode!"); return (CMfailed); }
progress = codes [progress];
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-s","--spin"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing spin mode!"); return (CMfailed); }
if ((spin = CMoptLookup (modes,argv [argPos],true)) == DBFault)
{ CMmsgPrint (CMmsgUsrError,"Invalid spin mode!"); return (CMfailed); }
spin = codes [spin];
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-P","--planet"))
{
int planet;
const char *planets [] = { "Earth", "Mars", "Venus", NULL };
DBFloat radius [] = { 6371.2213, 6371.2213 * 0.53264, 6371.2213 * 0.94886 };
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing planet!"); return (CMfailed); }
if ((planet = CMoptLookup (planets,argv [argPos],true)) == DBFault)
{
if (sscanf (argv [argPos],"%lf",radius) != 1)
{ CMmsgPrint (CMmsgUsrError,"Invalid planet!"); return (CMfailed); }
planet = 0;
}
DBMathSetGlobeRadius (radius [planet]);
if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-h","--help"))
{
CMmsgPrint (CMmsgInfo, "rgis [options]");
CMmsgPrint (CMmsgInfo, " -m, --metadb [meta database]");
CMmsgPrint (CMmsgInfo, " -p, --progress [yes|no]");
CMmsgPrint (CMmsgInfo, " -s, --spin [yes|no]");
CMmsgPrint (CMmsgInfo, " -P, --planet [Earth|Mars|Venus|radius]");
CMmsgPrint (CMmsgInfo, " -h, --help");
return (DBSuccess);
}
if ((argv [argPos][0] == '-') && (strlen (argv [argPos]) > 1))
{ CMmsgPrint (CMmsgUsrError, "Unknown option: %s!",argv [argPos]); return (DBFault); }
argPos++;
}
workspace = new RGISWorkspace;
mainForm = UIInitialize ((char *) "GHAAS V2.2 - RiverGIS",(char *) "GHAASrgis",(char *) "RGISMain.html",
RGISMainMenu,(void *) workspace,&argc,argv,720,500,(bool) spin,(bool) progress);
UIDataset ((char *) "GHAASrgis",metaDB);
XtVaSetValues (mainForm,XmNkeyboardFocusPolicy, XmPOINTER, NULL);
workspace->Initialize (mainForm);
if (argNum > 1)
{
DBDataset *dataset;
DBObjData *data;
DBObjectLIST<DBObjMetaEntry> *metaList;
DBObjMetaEntry *metaEntry;
dataset = UIDataset ();
metaList = dataset->MetaList ();
for (argPos = 1;argPos < argNum; ++argPos)
{
data = new DBObjData ();
if (data->Read (argv [argPos]) == DBSuccess)
{
workspace->CurrentData (data);
metaEntry = metaList->Item (data->Name ());
metaEntry->FileName (data->FileName ());
}
else delete data;
}
}
while (UILoop ());
delete UIDataset ();
return (DBSuccess);
}
示例7: main
int main (int argc,char *argv [])
{
int argPos, argNum = argc, numGrpNames = 0, i = 0;
char **groupnames, *rename = (char *) NULL, *tableName = (char *) NULL;
bool ascii = false;
FieldOptions *head = (FieldOptions *) NULL, *p = (FieldOptions *) NULL, *temp = (FieldOptions *) NULL;
Groups **groups = (Groups **) NULL;
FILE *outFile = (FILE *) NULL;
DBObjData *inData, *outData;
DBObjTable *inTable, *outTable;
DBObjTableField *field;
DBObjRecord *inRecord, *outRecord;
DBObjectLIST<DBObjTableField> *fields;
if(argc <= 2) { doHelp(false,argv[0]); return(DBSuccess); }
outData = new DBObjData("Untitled", DBTypeTable);
outTable = outData->Table(DBrNItems);
head = new FieldOptions(BAD,"","", (FieldOptions *) NULL);
groupnames = (char **) malloc(sizeof(char *));
for (argPos = 1;argPos < argNum;)
{
if (CMargTest(argv[argPos],"-f","--field"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing operation and field after -f!"); return (CMfailed); }
if(!strcmp(argv[argPos],"pct"))
{
if (argNum <= argPos + 2)
{ CMmsgPrint (CMmsgUsrError,"Missing field and/or percentage after -f pct!"); return (CMfailed); }
p = FOHierarchy(argv[argPos],argv[argPos+1],rename,atoi(argv[argPos+2]),head);
argNum = CMargShiftLeft(argPos,argv,argNum);
argNum = CMargShiftLeft(argPos,argv,argNum);
}
else if(!strcmp(argv[argPos],"num"))
{
char *num = new char[4];
strcpy(num,"Num");
p = FOHierarchy(argv[argPos],num,rename,-1,head);
}
else
{
if (argNum < argPos + 1)
{ CMmsgPrint (CMmsgUsrError,"Missing operation or field after -f %s!",argv[argPos]); return (CMfailed); }
p = FOHierarchy(argv[argPos],argv[argPos+1],rename,-1,head);
argNum = CMargShiftLeft(argPos,argv,argNum);
}
p->setPrint(true);
rename = (char *) NULL;
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-g","--group"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing groupname!"); return (CMfailed); }
if((groupnames = (char **) realloc(groupnames,(numGrpNames + 1) * sizeof(char *))) == (char **) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory allocation error in: %s %d",__FILE__,__LINE__); return(DBFault); }
groupnames[numGrpNames] = argv[argPos];
numGrpNames++;
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-h","--help"))
{
argNum = CMargShiftLeft (argPos,argv,argNum);
if(CMargTest(argv[argPos],"e","extend"))
{
doHelp(true,argv[0]);
argNum = CMargShiftLeft (argPos,argv,argNum);
}
else doHelp(false,argv[0]);
}
if (CMargTest(argv[argPos],"-c","--ascii"))
{
ascii = true;
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-a","--table"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing table name!"); return (CMfailed); }
tableName = argv[argPos];
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-r","--rename"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing field after -r!"); return (CMfailed); }
rename = argv[argPos];
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-o","--output"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing output filename!"); return (CMfailed); }
//.........这里部分代码省略.........