bool ArcNet::Node_Processing (Db_File *fh) { Node_File *file = (Node_File *) fh; XYZ_Point point; if (First_Record ()) { arcview_node.Num_Points (1); } if (Network_Service::Node_Processing (file)) { arcview_node.Copy_Fields (file); point.x = file->X (); point.y = file->Y (); point.z = file->Z (); arcview_node.points.Set (1, &point); if (!arcview_node.Write_Record ()) { Error ("Writing ArcView Node File"); } return (true); } return (false); }
void SimSubareas::Program_Control (void) { String key; //---- create the network files ---- Data_Service::Program_Control (); Node_File *file = System_Node_File (true); file->Subarea_Flag (true); file->Clear_Fields (); file->Create_Fields (); file->Write_Header (); Print (2, String ("%s Control Keys:") % Program ()); //---- get the subarea boundary file ---- key = Get_Control_String (SUBAREA_BOUNDARY_FILE); if (!key.empty ()) { boundary_file.File_Type ("Subarea Boundary File"); if (!boundary_file.Open (Project_Filename (key))) { Error (String ("Opening Boundary File %s") % boundary_file.Filename ()); } if (Check_Control_Key (SUBAREA_DATA_FIELD)) { key = Get_Control_Text (SUBAREA_DATA_FIELD); subarea_field = boundary_file.Required_Field (key); Print (0, String (" (Number = %d)") % (subarea_field + 1)); } else { subarea_field = boundary_file.Required_Field ("SUBAREA", "ID", "NUMBER", "PARTITION", "SUB"); } boundary_flag = true; update_flag = Get_Control_Flag (SUBAREA_UPDATE_FLAG); } else { //---- get the number of subareas ---- num_subareas = Get_Control_Integer (NUMBER_OF_SUBAREAS); subarea_count.assign (num_subareas, 0); //---- get the center node number --- center = Get_Control_Integer (CENTER_NODE_NUMBER); } }
int Data_Service::Put_Node_Data (Node_File &file, Node_Data &data) { file.Node (data.Node ()); file.X (UnRound (data.X ())); file.Y (UnRound (data.Y ())); file.Z (UnRound (data.Z ())); file.Subarea (data.Subarea ()); file.Partition (data.Partition ()); file.Notes (data.Notes ()); if (!file.Write ()) { Error (String ("Writing %s") % file.File_Type ()); } return (1); }
bool ArcNet::Get_Node_Data (Node_File &file, Node_Data &node_rec) { if (Data_Service::Get_Node_Data (file, node_rec)) { if (arcview_node.Is_Open ()) { arcview_node.Copy_Fields (file); XYZ_Point *point = arcview_node.Get_Points (); point->x = file.X (); point->y = file.Y (); point->z = file.Z (); if (!arcview_node.Write_Record ()) { Error (String ("Writing %s") % arcview_node.File_Type ()); } } return (true); } return (false); }
void Data_Service::Write_Nodes (void) { Node_File *file = (Node_File *) System_File_Handle (NEW_NODE); int count = 0; Int_Map_Itr itr; Show_Message (String ("Writing %s -- Record") % file->File_Type ()); Set_Progress (); for (itr = node_map.begin (); itr != node_map.end (); itr++) { Show_Progress (); count += Put_Node_Data (*file, node_array [itr->second]); } Show_Progress (count); End_Progress (); file->Close (); Print (2, String ("%s Records = %d") % file->File_Type () % count); }
bool SubareaNet::Node_Processing (Db_File *fh) { Node_File *file = (Node_File *) fh; //---- reserve memory ---- if (First_Record ()) { if (!node_db.Max_Records (file->Num_Records ())) { Error ("Insufficient Memory for Node Database"); } } //---- do standard processing ---- if (Network_Service::Node_Processing (fh)) { //---- copy the record to the node database ---- node_db.Copy_Fields (file); if (!node_db.Add_Record ()) { Error ("Writing Node Database"); } //---- check the subarea boundary ---- Node_Data *node_ptr = node_data.New_Record (); if (In_Polygon (UnRound (node_ptr->X ()), UnRound (node_ptr->Y ()), &subarea_boundary.points)) { node_ptr->Type (1); } else { node_ptr->Type (0); } return (true); } return (false); }