void RGISAnalysePointSubbasinHistCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData) { char *selection; DBDataset *dataset = UIDataset (); DBObjData *pntData = dataset->Data (); DBObjData *grdData = pntData->LinkedData (); DBObjData *netData; DBObjData *tblData; static Widget selectWidget = (Widget) NULL; if (selectWidget == (Widget) NULL) selectWidget = UISelectionCreate ((char *) "Select Network"); if ((selection = UISelectObject (selectWidget,(DBObjectLIST<DBObject> *) dataset->DataList (),_RGISAnalyseTestNetwork)) == (char *) NULL) return; if ((netData = dataset->Data (selection)) == (DBObjData *) NULL) { return; } tblData = new DBObjData ("",DBTypeTable); tblData->Document (DBDocGeoDomain,pntData->Document (DBDocGeoDomain)); tblData->Document (DBDocSubject,"Subbasin Histogram"); if (UIDataHeaderForm (tblData)) { UIPauseDialogOpen ((char *) "Calculating Histogram"); if (RGlibPointSubbasinHist (pntData,netData,grdData,tblData) == DBSuccess) workspace->CurrentData (tblData); else delete tblData; UIPauseDialogClose (); } else delete tblData; }
void RGISAnNetworkToGridCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData) { char *selection; DBInt dataType; DBDataset *dataset = UIDataset (); DBObjData *netData = dataset->Data (); DBObjTable *cellTable = netData->Table (DBrNCells); DBObjTableField *field; DBObjData *grdData; static Widget select = NULL; if (select == NULL) select = UISelectionCreate ((char *) "Field Selection"); selection = UISelectObject (select,(DBObjectLIST<DBObject> *) (cellTable->Fields ()),DBTableFieldIsSimple); if (selection == (char *) NULL) return; if ((field = cellTable->Field (selection)) == (DBObjTableField *) NULL) { CMmsgPrint (CMmsgAppError,"Corrupt Network Dataset in: %s %d",__FILE__,__LINE__); return; } if (DBTableFieldIsCategory (field) && DBTableFieldIsNumeric (field)) { DBObjData *tmpData; tmpData = new DBObjData ("",DBTypeGrid); tmpData->Document (DBDocGeoDomain,netData->Document (DBDocGeoDomain)); tmpData->Document (DBDocSubject,field->Name ()); if (UIDataHeaderForm (tmpData)) { grdData = DBNetworkToGrid (netData,tmpData->Type ()); grdData->Name (tmpData->Name ()); grdData->Document (DBDocGeoDomain,tmpData->Document (DBDocGeoDomain)); grdData->Document (DBDocSubject,tmpData->Document (DBDocSubject)); grdData->Document (DBDocVersion,tmpData->Document (DBDocVersion)); grdData->Document (DBDocCitationRef,tmpData->Document (DBDocCitationRef)); grdData->Document (DBDocCitationInst,tmpData->Document (DBDocCitationInst)); grdData->Document (DBDocSourceInst,tmpData->Document (DBDocSourceInst)); grdData->Document (DBDocSourcePerson,tmpData->Document (DBDocSourcePerson)); grdData->Document (DBDocOwnerPerson,tmpData->Document (DBDocOwnerPerson)); grdData->Document (DBDocComment,tmpData->Document (DBDocComment)); delete tmpData; } else { return; } } else { if (DBTableFieldIsCategory (field)) dataType = DBTypeGridDiscrete; else if (DBTableFieldIsNumeric (field)) dataType = DBTypeGridContinuous; else { CMmsgPrint (CMmsgAppError,"Invalid field type in: %s %d",__FILE__,__LINE__); return; } grdData = DBNetworkToGrid (netData,dataType); if (UIDataHeaderForm (grdData) == false) { delete grdData; return; } } UIPauseDialogOpen ((char *) "Converting Network to Grid"); if (RGlibNetworkToGrid (netData,field,grdData) == DBSuccess) workspace->CurrentData (grdData); else delete grdData; UIPauseDialogClose (); }
void UIAuxObjectSelectCBK(Widget widget, Widget text, XmAnyCallbackStruct *callData) { static Widget select = NULL; char *objName; int (*condFunc)(const DBObject *); DBObjectLIST<DBObject> *objects; if (select == NULL) select = UISelectionCreate((char *) "Object Selection"); XtVaGetValues(text, XmNuserData, &objects, NULL); XtVaGetValues(widget, XmNuserData, &condFunc, NULL); if ((objName = UISelectObject(select, objects, condFunc)) != NULL) XmTextFieldSetString(text, objName); }
static void _RGIAnalyseLineSSampleGridSSelectCBK (Widget widget,Widget text,XmAnyCallbackStruct *callData) { static Widget select = NULL; char *field; int (*condFunc) (const DBObject *); if (select == NULL) select = UISelectionCreate ((char *) "Field Selection"); XtVaGetValues (widget,XmNuserData, &condFunc, NULL); if ((field = UISelectObject (select,(DBObjectLIST<DBObject> *) (_RGISAnLineSampleGridFields),condFunc)) != NULL) XmTextFieldSetString (text,field); }
static void _RGISARCInfoImportFieldSelectCBK (Widget widget,Widget text,XmAnyCallbackStruct *callData) { static Widget select = NULL; char *field; int (*condFunc) (const DBObject *); if (select == NULL) select = UISelectionCreate ((char *) "ARC/Info Fields"); XtVaGetValues (widget,XmNuserData, &condFunc, NULL); if ((field = UISelectObject (select,(DBObjectLIST<DBObject> *) (_RGISARCTempTable->Fields ()),condFunc)) != NULL) XmTextFieldSetString (text,field); }
static void _RGISEditPointSTNCoordsSelectCBK (Widget widget,Widget text,XmAnyCallbackStruct *callData) { static Widget select = NULL; char *field; DBObjectLIST<DBObjTableField> *fields; callData = callData; if (select == NULL) select = UISelectionCreate ((char *) "Field Selection"); XtVaGetValues (text,XmNuserData, &fields, NULL); if ((field = UISelectObject (select,(DBObjectLIST<DBObject> *) fields,DBTableFieldIsFloat)) != NULL) XmTextFieldSetString (text,field); else XmTextFieldSetString (text,(char *) ""); }
static void _RGISToolsExportASCIICBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData) { char *selection; DBDataset *dataset = UIDataset (); DBObjData *data = dataset->Data (); DBObjTable *table; static Widget fileSelect = NULL; static Widget tableSelect = (Widget) NULL; widget = widget; workspace = workspace; callData = callData; if (tableSelect == (Widget) NULL) tableSelect = UISelectionCreate ((char *) "Table Selection"); if (fileSelect == NULL) fileSelect = UIFileSelectionCreate ((char *) "ASCII Table",NULL,(char *) "*.txt",XmFILE_REGULAR); table = data->Table (UISelectObject (tableSelect,(DBObjectLIST<DBObject> *) data->Tables ())); if (table == (DBObjTable *) NULL) return; if ((selection = UIFileSelection (fileSelect,False)) == NULL) return; DBExportASCIITable (table, selection); }
static void _RGISGrpPanelDeleteCBK (Widget widget,RGISGrpPanel *grpPanel,XmAnyCallbackStruct *callData) { DBDataset *dataset = UIDataset (); DBObjData *dbData = dataset->Data (); DBObjTable *groupTable = dbData->Table (DBrNGroups); DBObjTableField *group = grpPanel->Current (); static Widget fieldSelect = (Widget) NULL; if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Group Selection"); if ((groupTable == (DBObjTable *) NULL) || (group == (DBObjTableField *) NULL)) return; if (groupTable->FieldNum () == 1) grpPanel->Groups ((DBObjectLIST<DBObjTableField> *) NULL); grpPanel->Remove (group); groupTable->DeleteField (group); if (groupTable->FieldNum () == 0) { DBObjectLIST<DBObjTable> *tables = dbData->Tables (); tables->Remove (groupTable); delete groupTable; } }
void RGISAnalysePointInterStationTSCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData) { char *selection; DBDataset *dataset = UIDataset (); DBObjMetaEntry *metaEntry; DBObjData *pntData = dataset->Data (), *tsData; DBObjTable *relateTBL = pntData->Table (DBrNRelations); DBObjRecord *relateRec; DBObjTableField *relDataFLD; DBObjTableField *relateFLD; DBObjTableField *joinFLD; static Widget selectWidget = (Widget) NULL; if (selectWidget == (Widget) NULL) selectWidget = UISelectionCreate ((char *) "Select Time Series"); if ((selection = UISelectObject (selectWidget,(DBObjectLIST<DBObject> *) relateTBL)) == (char *) NULL) return; if ((relateRec = relateTBL->Item (selection)) == (DBObjRecord *) NULL) { CMmsgPrint (CMmsgAppError, "Relate Record Error in: %s %d",__FILE__,__LINE__); return; } relDataFLD = relateTBL->Field (DBrNRelateData); relateFLD = relateTBL->Field (DBrNRelateField); joinFLD = relateTBL->Field (DBrNRelateJoinField); if ((tsData = dataset->Data (relDataFLD->String (relateRec))) == (DBObjData *) NULL) { if ((metaEntry = dataset->Meta (relDataFLD->String (relateRec))) == (DBObjMetaEntry *) NULL) { CMmsgPrint (CMmsgAppError, "Meta Enrty Finding Error in: %s %d",__FILE__,__LINE__); return; } tsData = new DBObjData (); if (tsData->Read (metaEntry->FileName ()) != DBSuccess) return; } workspace->CurrentData (tsData); UIPauseDialogOpen ((char *) "Calculating"); RGlibPointInterStationTS (pntData,tsData,relateFLD->String (relateRec),joinFLD->String (relateRec)); UIPauseDialogClose (); }
void RGISAnNetworkStreamLinesCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData) { char *selection; DBDataset *dataset = UIDataset (); DBObjData *netData = dataset->Data (); DBObjTable *cellTable = netData->Table (DBrNCells); DBObjData *arcData = new DBObjData ("",DBTypeVectorLine); DBNetworkIF *netIF = new DBNetworkIF (netData); static Widget fieldSelect = (Widget) NULL; widget = widget; callData = callData; if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Select Field"); if ((selection = UISelectObject (fieldSelect,(DBObjectLIST<DBObject> *) cellTable->Fields (),DBTableFieldIsInteger)) == (char *) NULL) return; if ((_RGISAnNetOrderField = cellTable->Field (selection)) == (DBObjTableField *) NULL) { CMmsgPrint (CMmsgAppError, "Field Selection Error in: %s %d",__FILE__,__LINE__); return; } arcData->Document (DBDocGeoDomain,netData->Document (DBDocGeoDomain)); arcData->Document (DBDocSubject,"Stream Lines"); if (UIDataHeaderForm (arcData)) { DBInt cellID; char objName [DBStringLength]; DBVLineIF *lineIF = new DBVLineIF (arcData); DBObjTable *cellTable = netData->Table (DBrNCells); DBObjTable *lineTable = arcData->Table (DBrNItems); DBObjTableField *basinFLD = new DBObjTableField (DBrNBasin,DBTableFieldInt,"%8d",sizeof (DBInt)); DBObjTableField *fieldFLD = new DBObjTableField (_RGISAnNetOrderField->Name (), _RGISAnNetOrderField->Type (), _RGISAnNetOrderField->Format (), _RGISAnNetOrderField->Length ()); DBObjTableField *lengthFLD = new DBObjTableField (RGISNetStreamLength,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4)); DBObjTableField *areaFLD = new DBObjTableField (RGISNetStreamArea,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4)); DBObjTableField *basinAreaFLD = new DBObjTableField (RGISNetBasinArea,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4)); DBObjTableField *nextFLD = new DBObjTableField (RGISNetStreamNext,DBTableFieldInt,"%6d",sizeof (DBInt)); DBObjRecord *cellRec, *toCellRec, *lineRec; arcData->Projection (netData->Projection ()); arcData->Precision (netData->Precision ()); arcData->MaxScale (netData->MaxScale ()); arcData->MinScale (netData->MinScale ()); lineTable->AddField (basinFLD); lineTable->AddField (fieldFLD); lineTable->AddField (lengthFLD); lineTable->AddField (areaFLD); lineTable->AddField (basinAreaFLD); lineTable->AddField (nextFLD); cellTable->AddField (_RGISAnNetStreamIDFLD = new DBObjTableField ("StreamID",DBTableFieldInt,"%8d",sizeof (DBInt))); _RGISAnNetStreamID = 0; UIPauseDialogOpen ((char *) "Creating Stream Lines"); cellID = netIF->CellNum () - 1; cellRec = netIF->Cell (cellID); if (lineIF->NewSymbol ("Default Symbol") == (DBObjRecord *) NULL) { CMmsgPrint (CMmsgAppError, "Symbol Creation Error in: %s %d",__FILE__,__LINE__); return; } for (;cellID >= 0;--cellID) { cellRec = netIF->Cell (cellID); if (((toCellRec = netIF->ToCell (cellRec)) == (DBObjRecord *) NULL) || (_RGISAnNetOrderField->Int (cellRec) != _RGISAnNetOrderField->Int (toCellRec)) || (netIF->CellOrder (cellRec) != netIF->CellOrder (toCellRec))) { if (UIPause ((netIF->CellNum () - cellRec->RowID ()) * 100 / netIF->CellNum ())) goto Stop; sprintf (objName,"Line: %5d",_RGISAnNetStreamID + 1); if ((lineRec = lineIF->NewItem (objName)) == (DBObjRecord *) NULL) { CMmsgPrint (CMmsgAppError, "Line Insertion Error in: %s %d",__FILE__,__LINE__); return; } nextFLD->Int (lineRec,toCellRec == (DBObjRecord *) NULL ? 0 : _RGISAnNetStreamIDFLD->Int (toCellRec) + 1); basinFLD->Int (lineRec,netIF->CellBasinID (cellRec)); fieldFLD->Int (lineRec,_RGISAnNetOrderField->Int (cellRec)); _RGISAnNetVertex = 0; netIF->UpStreamSearch (_RGISAnNetworkCellRec = cellRec,(DBNetworkACTION) _RGISAnNetworkUpStreamAction); lineIF->FromNode (lineRec,lineIF->Node (netIF->Center (_RGISAnNetworkCellRec),true)); lineIF->ToNode (lineRec,lineIF->Node (netIF->Center (cellRec) + netIF->Delta (cellRec),true)); _RGISAnNetArea = netIF->CellArea (_RGISAnNetworkCellRec); if (_RGISAnNetVertex > 1) { if (_RGISAnNetVertexNum < _RGISAnNetVertex - 1) { _RGISAnNetCoord = (DBCoordinate *) realloc (_RGISAnNetCoord,(_RGISAnNetVertex - 1) * sizeof (DBCoordinate)); if (_RGISAnNetCoord == (DBCoordinate *) NULL) { CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return; } } _RGISAnNetVertex = 0; netIF->DownStreamSearch (netIF->ToCell (_RGISAnNetworkCellRec),(DBNetworkACTION) _RGISAnNetworkDownStreamAction); } else _RGISAnNetVertex = 0; lineIF->Vertexes (lineRec,_RGISAnNetCoord,_RGISAnNetVertex); lineIF->ItemSymbol (lineRec,lineIF->Symbol (0)); lengthFLD->Float (lineRec,netIF->CellBasinLength (cellRec)); areaFLD->Float (lineRec,_RGISAnNetArea); basinAreaFLD->Float (lineRec,netIF->CellBasinArea (cellRec)); _RGISAnNetStreamID += 1; } } Stop: UIPauseDialogClose (); if (_RGISAnNetCoord != (DBCoordinate *) NULL) free (_RGISAnNetCoord); delete lineIF; if (cellID >= 0) delete arcData; else workspace->CurrentData (arcData); } else delete arcData; delete netIF; }
void RGISToolsConvertToPointCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData) { char *nText, *xText, *yText, *selection; int allowOk; static int convert; DBDataset *dataset = UIDataset (); DBObjData *dbData = dataset->Data (); DBObjTable *itemTable; static Widget tableSelect = (Widget) NULL; static Widget dShell = (Widget) NULL, mainForm; static Widget nameTextF, xCoordTextF, yCoordTextF; XmString string; if (tableSelect == (Widget) NULL) tableSelect = UISelectionCreate ((char *) "Table Selection"); selection = UISelectObject (tableSelect,(DBObjectLIST<DBObject> *) dbData->Tables ()); if (selection == (char *) NULL) return; if ((itemTable = dbData->Table (selection)) == (DBObjTable *) NULL) { CMmsgPrint (CMmsgAppError, "Invalid Table in: %s %d",__FILE__,__LINE__); return; } _RGISToolsConvertToPointFields = itemTable->Fields (); if (dShell == (Widget) NULL) { Widget button; dShell = UIDialogForm ((char *) "Convert Table To Point",false); mainForm = UIDialogFormGetMainForm (dShell); string = XmStringCreate ((char *) "Select",UICharSetBold); button = XtVaCreateManagedWidget ("RGISToolsConvertToPointNameButton",xmPushButtonWidgetClass,mainForm, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNmarginHeight, 5, XmNtraversalOn, False, XmNlabelString, string, XmNuserData, DBTableFieldIsString, NULL); XmStringFree (string); nameTextF = XtVaCreateManagedWidget ("RGISToolsConvertToPointNameTextF",xmTextFieldWidgetClass,mainForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, button, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, button, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, button, XmNmaxLength, DBStringLength, XmNcolumns, DBStringLength / 2, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _RGISToolsConvertToPointSelectCBK,nameTextF); string = XmStringCreate ((char *) "Name Field:",UICharSetBold); XtVaCreateManagedWidget ("RGISToolsConvertToPointNameLabel",xmLabelWidgetClass,mainForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, button, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, nameTextF, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, button, XmNlabelString, string, NULL); XmStringFree (string); string = XmStringCreate ((char *) "Select",UICharSetBold); button = XtVaCreateManagedWidget ("RGISToolsConvertToPointXCoordButton",xmPushButtonWidgetClass,mainForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, button, XmNtopOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNmarginHeight, 5, XmNtraversalOn, False, XmNlabelString, string, XmNuserData, DBTableFieldIsNumeric, NULL); XmStringFree (string); xCoordTextF = XtVaCreateManagedWidget ("RGISToolsConvertToPointXCoordTextF",xmTextFieldWidgetClass,mainForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, button, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, button, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, button, XmNmaxLength, DBStringLength, XmNcolumns, DBStringLength / 2, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _RGISToolsConvertToPointSelectCBK,xCoordTextF); string = XmStringCreate ((char *) "X Coordinate:",UICharSetBold); XtVaCreateManagedWidget ("RGISToolsConvertToPointXCoordLabel",xmLabelWidgetClass,mainForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, button, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, nameTextF, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, button, XmNlabelString, string, NULL); XmStringFree (string); string = XmStringCreate ((char *) "Select",UICharSetBold); button = XtVaCreateManagedWidget ("RGISToolsConvertToPointYCoordButton",xmPushButtonWidgetClass,mainForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, button, XmNtopOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNmarginHeight, 5, XmNtraversalOn, False, XmNlabelString, string, XmNuserData, DBTableFieldIsNumeric, NULL); XmStringFree (string); yCoordTextF = XtVaCreateManagedWidget ("RGISToolsConvertToPointYCoordTextF",xmTextFieldWidgetClass,mainForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, button, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, button, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, button, XmNmaxLength, DBStringLength, XmNcolumns, DBStringLength / 2, NULL); XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _RGISToolsConvertToPointSelectCBK,yCoordTextF); string = XmStringCreate ((char *) "Y Coordinate:",UICharSetBold); XtVaCreateManagedWidget ("RGISToolsConvertToPointYCoordLabel",xmLabelWidgetClass,mainForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, button, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, nameTextF, XmNrightOffset, 10, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, button, XmNlabelString, string, NULL); XmStringFree (string); XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&convert); } convert = false; UIDialogFormPopup (dShell); while (UILoop ()) { xText = XmTextFieldGetString (xCoordTextF); yText = XmTextFieldGetString (yCoordTextF); allowOk = (strlen (xText) > 0) && (strlen (yText) > 0); XtFree (xText); XtFree (yText); XtSetSensitive (UIDialogFormGetOkButton (dShell),allowOk); } UIDialogFormPopdown (dShell); if (convert) { DBObjData *pntData = new DBObjData ("",DBTypeVectorPoint); pntData->Name (dbData->Name ()); pntData->Document (DBDocSubject,dbData->Document (DBDocSubject)); pntData->Document (DBDocGeoDomain,dbData->Document (DBDocGeoDomain)); if (UIDataHeaderForm (pntData)) { DBCoordinate coord; DBObjTableField *nField, *xField, *yField, *tblFLD, *pntFLD; DBObjRecord *tblRec, *pntRec, *symRec; DBObjTable *pntTable = pntData->Table (DBrNItems); DBObjTable *symbols = pntData->Table (DBrNSymbols); DBObjTableField *symbolIDFLD = symbols->Field (DBrNSymbolID); DBObjTableField *fgFLD = symbols->Field (DBrNForeground); DBObjTableField *bgFLD = symbols->Field (DBrNBackground); DBObjTableField *stFLD = symbols->Field (DBrNStyle); DBObjTableField *coordFLD = pntTable->Field (DBrNCoord); DBObjTableField *symbolFLD = pntTable->Field (DBrNSymbol); DBRegion extent; symRec = symbols->Add ("Default Symbol"); symbolIDFLD->Int (symRec,0); fgFLD->Int (symRec,1); bgFLD->Int (symRec,2); stFLD->Int (symRec,0); nText = XmTextFieldGetString (nameTextF); xText = XmTextFieldGetString (xCoordTextF); yText = XmTextFieldGetString (yCoordTextF); nField = _RGISToolsConvertToPointFields->Item (nText); xField = _RGISToolsConvertToPointFields->Item (xText); yField = _RGISToolsConvertToPointFields->Item (yText); XtFree (nText); XtFree (xText); XtFree (yText); for (tblRec = itemTable->First ();tblRec != (DBObjRecord *) NULL;tblRec = itemTable->Next ()) { if (CMmathEqualValues (coord.X = xField->Float (tblRec),xField->FloatNoData ())) continue; if (CMmathEqualValues (coord.Y = yField->Float (tblRec),yField->FloatNoData ())) continue; if (nField == (DBObjTableField *) NULL) pntRec = pntTable->Add (tblRec->Name ()); else pntRec = pntTable->Add (nField->String (tblRec)); coordFLD->Coordinate (pntRec,coord); symbolFLD->Record (pntRec,symRec); extent.Expand (coord); } pntData->Extent (extent); pntData->Projection (DBMathGuessProjection (extent)); pntData->Precision (DBMathGuessPrecision (extent)); for (tblFLD = _RGISToolsConvertToPointFields->First ();tblFLD != (DBObjTableField *) NULL;tblFLD = _RGISToolsConvertToPointFields->Next ()) if ((tblFLD != nField) && (tblFLD != xField) && (tblFLD != yField) && DBTableFieldIsVisible (tblFLD)) { pntTable->AddField (pntFLD = new DBObjTableField (*tblFLD)); pntFLD->Required (false); pntRec = pntTable->First (); for (tblRec = itemTable->First ();tblRec != (DBObjRecord *) NULL;tblRec = itemTable->Next ()) { if (CMmathEqualValues (coord.X = xField->Float (tblRec),xField->FloatNoData ())) continue; if (CMmathEqualValues (coord.Y = yField->Float (tblRec),yField->FloatNoData ())) continue; switch (tblFLD->Type ()) { case DBTableFieldString: pntFLD->String (pntRec,tblFLD->String (tblRec)); break; case DBTableFieldInt: pntFLD->Int (pntRec,tblFLD->Int (tblRec)); break; case DBTableFieldFloat: pntFLD->Float (pntRec,tblFLD->Float (tblRec)); break; case DBTableFieldDate: pntFLD->Date (pntRec,tblFLD->Date (tblRec)); break; default: CMmsgPrint (CMmsgAppError, "Invalid Field Type in: %s %d",__FILE__,__LINE__); break; } pntRec = pntTable->Next (); } } workspace->CurrentData (pntData); } else delete pntData; } }