这篇教程C++ Error_Set函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Error_Set函数的典型用法代码示例。如果您正苦于以下问题:C++ Error_Set函数的具体用法?C++ Error_Set怎么用?C++ Error_Set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Error_Set函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Error_Setbool Cdodproperror::SaveGridsAsTIFF(CSG_Grid** grids, CSG_Strings paths){ TSG_Data_Type Type; CSG_String FilePath; CSG_Grid* Grid; // SAVE TIFFS for (int i = 0; i < paths.Get_Count(); i++) { FilePath = paths[i]; Grid = grids[i]; Type = Grid->Get_Type(); if( !GDALDataSet.Open_Write(FilePath, GDALDriver, GDALOptions, Type, 1, *Get_System(), Projection) ) { Error_Set(CSG_String::Format(SG_T("%s: '%s' "), _TL("Failed to open file for writing: "), FilePath.c_str())); return( false ); } GDALDataSet.Write(0, Grid); if( !GDALDataSet.Close() ) { Error_Set(CSG_String::Format(SG_T("%s: '%s' "), _TL("Failed to close file after writing: "), FilePath.c_str())); return( false ); } } return true;}
开发者ID:sina-masoud-ansari,项目名称:saga-gis,代码行数:28,
示例2: Parameters//---------------------------------------------------------bool CPolygon_Geometrics::On_Execute(void){ //------------------------------------------------- int bParts = Parameters("BPARTS") ->asBool() ? 0 : -1; int bPoints = Parameters("BPOINTS") ->asBool() ? 0 : -1; int bLength = Parameters("BLENGTH") ->asBool() ? 0 : -1; int bArea = Parameters("BAREA") ->asBool() ? 0 : -1; if( bParts && bPoints && bLength && bArea ) { Error_Set(_TL("no properties selected")); return( false ); } //------------------------------------------------- CSG_Shapes *pPolygons = Parameters("POLYGONS")->asShapes(); if( !pPolygons->is_Valid() || pPolygons->Get_Count() <= 0 ) { Error_Set(_TL("invalid lines layer")); return( false ); } if( Parameters("OUTPUT")->asShapes() && Parameters("OUTPUT")->asShapes() != pPolygons ) { pPolygons = Parameters("OUTPUT")->asShapes(); pPolygons->Create(*Parameters("POLYGONS")->asShapes()); } //------------------------------------------------- if( !bParts ) { bParts = pPolygons->Get_Field_Count(); pPolygons->Add_Field(SG_T("NPARTS") , SG_DATATYPE_Int ); } if( !bPoints ) { bPoints = pPolygons->Get_Field_Count(); pPolygons->Add_Field(SG_T("NPOINTS") , SG_DATATYPE_Int ); } if( !bLength ) { bLength = pPolygons->Get_Field_Count(); pPolygons->Add_Field(SG_T("PERIMETER"), SG_DATATYPE_Double); } if( !bArea ) { bArea = pPolygons->Get_Field_Count(); pPolygons->Add_Field(SG_T("AREA") , SG_DATATYPE_Double); } //------------------------------------------------- for(int i=0; i<pPolygons->Get_Count() && Set_Progress(i, pPolygons->Get_Count()); i++) { CSG_Shape *pPolygon = pPolygons->Get_Shape(i); if( bParts >= 0 ) pPolygon->Set_Value(bParts , pPolygon->Get_Part_Count()); if( bPoints >= 0 ) pPolygon->Set_Value(bPoints, pPolygon->Get_Point_Count()); if( bLength >= 0 ) pPolygon->Set_Value(bLength, ((CSG_Shape_Polygon *)pPolygon)->Get_Perimeter()); if( bArea >= 0 ) pPolygon->Set_Value(bArea , ((CSG_Shape_Polygon *)pPolygon)->Get_Area()); } //------------------------------------------------- if( pPolygons == Parameters("POLYGONS")->asShapes() ) { DataObject_Update(pPolygons); } return( true );}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:57,
示例3: Parameters//---------------------------------------------------------bool CLine_Properties::On_Execute(void){ //------------------------------------------------- int bParts = Parameters("BPARTS") ->asBool() ? 0 : -1; int bPoints = Parameters("BPOINTS") ->asBool() ? 0 : -1; int bLength = Parameters("BLENGTH") ->asBool() ? 0 : -1; if( bParts && bPoints && bLength ) { Error_Set(_TL("no properties selected")); return( false ); } //------------------------------------------------- CSG_Shapes *pLines = Parameters("LINES")->asShapes(); if( !pLines->is_Valid() || pLines->Get_Count() <= 0 ) { Error_Set(_TL("invalid lines layer")); return( false ); } if( Parameters("OUTPUT")->asShapes() && Parameters("OUTPUT")->asShapes() != pLines ) { pLines = Parameters("OUTPUT")->asShapes(); pLines->Create(*Parameters("LINES")->asShapes()); } //------------------------------------------------- if( !bParts ) { bParts = pLines->Get_Field_Count(); pLines->Add_Field(SG_T("NPARTS") , SG_DATATYPE_Int ); } if( !bPoints ) { bPoints = pLines->Get_Field_Count(); pLines->Add_Field(SG_T("NPOINTS"), SG_DATATYPE_Int ); } if( !bLength ) { bLength = pLines->Get_Field_Count(); pLines->Add_Field(SG_T("LENGTH") , SG_DATATYPE_Double); } //------------------------------------------------- for(int i=0; i<pLines->Get_Count() && Set_Progress(i, pLines->Get_Count()); i++) { CSG_Shape *pLine = pLines->Get_Shape(i); if( bParts >= 0 ) pLine->Set_Value(bParts , pLine->Get_Part_Count()); if( bPoints >= 0 ) pLine->Set_Value(bPoints, pLine->Get_Point_Count()); if( bLength >= 0 ) pLine->Set_Value(bLength, ((CSG_Shape_Line *)pLine)->Get_Length()); } //------------------------------------------------- if( pLines == Parameters("LINES")->asShapes() ) { DataObject_Update(pLines); } return( true );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:54,
示例4: Parameters//---------------------------------------------------------bool COGR_Export_KML::On_Execute(void){ CSG_Shapes Shapes, *pShapes = Parameters("SHAPES")->asShapes(); //----------------------------------------------------- if( pShapes->Get_Projection().Get_Type() == SG_PROJ_TYPE_CS_Undefined ) { Message_Add(_TL("layer uses undefined coordinate system, assuming geographic coordinates")); } else if( pShapes->Get_Projection().Get_Type() != SG_PROJ_TYPE_CS_Geographic ) { Message_Fmt("/n%s (%s: %s)/n", _TL("re-projection to geographic coordinates"), _TL("original"), pShapes->Get_Projection().Get_Name().c_str()); bool bResult; SG_RUN_TOOL(bResult, "pj_proj4", 2, SG_TOOL_PARAMETER_SET("SOURCE" , pShapes) && SG_TOOL_PARAMETER_SET("TARGET" , &Shapes) && SG_TOOL_PARAMETER_SET("CRS_PROJ4", SG_T("+proj=longlat +ellps=WGS84 +datum=WGS84")) ); if( bResult ) { pShapes = &Shapes; Message_Fmt("/n%s: %s/n", _TL("re-projection"), _TL("success")); } else { Message_Fmt("/n%s: %s/n", _TL("re-projection"), _TL("failed" )); } } //----------------------------------------------------- CSG_OGR_DataSet DataSource; if( !DataSource.Create(Parameters("FILE")->asString(), "KML") ) { Error_Set(_TL("KML file creation failed")); return( false ); } if( !DataSource.Write(pShapes) ) { Error_Set(_TL("failed to store data")); return( false ); } return( true );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:53,
示例5: Parameters//---------------------------------------------------------bool CFilter_Resample::On_Execute(void){ double Cellsize; CSG_Grid *pGrid, *pLoPass, *pHiPass; //----------------------------------------------------- pGrid = Parameters("GRID" )->asGrid(); pLoPass = Parameters("LOPASS")->asGrid(); pHiPass = Parameters("HIPASS")->asGrid(); Cellsize = Parameters("SCALE" )->asDouble() * Get_Cellsize(); //----------------------------------------------------- if( Cellsize > 0.5 * SG_Get_Length(Get_System()->Get_XRange(), Get_System()->Get_YRange()) ) { Error_Set(_TL("resampling cell size is too large")); return( false ); } //----------------------------------------------------- CSG_Grid Grid(CSG_Grid_System(Cellsize, Get_XMin(), Get_YMin(), Get_XMax(), Get_YMax()), SG_DATATYPE_Float); Grid.Assign(pGrid, GRID_RESAMPLING_Mean_Cells); //----------------------------------------------------- pLoPass->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), _TL("Low Pass"))); pHiPass->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), _TL("High Pass"))); CSG_Colors Colors; DataObject_Get_Colors(pGrid , Colors); DataObject_Set_Colors(pLoPass, Colors); DataObject_Set_Colors(pHiPass, 11, SG_COLORS_RED_GREY_BLUE); //----------------------------------------------------- for(int y=0; y<Get_NY() && Set_Progress(y); y++) { double py = Get_YMin() + y * Get_Cellsize(); #pragma omp parallel for for(int x=0; x<Get_NX(); x++) { double z, px = Get_XMin() + x * Get_Cellsize(); if( !pGrid->is_NoData(x, y) && Grid.Get_Value(px, py, z) ) { pLoPass->Set_Value(x, y, z); pHiPass->Set_Value(x, y, pGrid->asDouble(x, y) - z); } else { pLoPass->Set_NoData(x, y); pHiPass->Set_NoData(x, y); } } } //----------------------------------------------------- return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:61,
示例6: Parameters//---------------------------------------------------------bool CGeoref_Grid::On_Execute(void){ CSG_Shapes *pShapes_A = Parameters("REF_SOURCE")->asShapes(); CSG_Shapes *pShapes_B = Parameters("REF_TARGET")->asShapes(); int xField = Parameters("XFIELD")->asInt(); int yField = Parameters("YFIELD")->asInt(); //----------------------------------------------------- if( ( pShapes_B && m_Engine.Set_Reference(pShapes_A, pShapes_B)) || (!pShapes_B && m_Engine.Set_Reference(pShapes_A, xField, yField)) ) { int Method = Parameters("METHOD")->asInt(); int Order = Parameters("ORDER" )->asInt(); if( m_Engine.Evaluate(Method, Order) && Get_Conversion() ) { m_Engine.Destroy(); return( true ); } } //----------------------------------------------------- if( !m_Engine.Get_Error().is_Empty() ) { Error_Set(m_Engine.Get_Error()); } m_Engine.Destroy(); return( false );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:34,
示例7: Parameters//---------------------------------------------------------bool CCost_Accumulated::On_Execute(void){ //----------------------------------------------------- m_pCost = Parameters("COST" )->asGrid(); m_pAccumulated = Parameters("ACCUMULATED")->asGrid(); m_pAllocation = Parameters("ALLOCATION" )->asGrid(); m_pDirection = Parameters("DIR_MAXCOST")->asGrid(); m_bDegree = Parameters("DIR_UNIT" )->asInt() == 1; m_dK = Parameters("DIR_K" )->asDouble(); //----------------------------------------------------- CPoints Points; if( !Get_Destinations(Points) ) { Error_Set(_TL("no destination points in grid area.")); return( false ); } //----------------------------------------------------- Get_Cost(Points); Get_Allocation(); //----------------------------------------------------- return( true );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:29,
示例8: On_Execute//---------------------------------------------------------bool CShapes_SRID_Update::On_Execute(void){ if( !Get_Connection()->has_PostGIS() ) { Error_Set(_TL("no PostGIS layer")); return( false ); } //----------------------------------------------------- CSG_String Select; CSG_Table Table; Select.Printf(SG_T("f_table_name='%s'"), Parameters("TABLES")->asString()); if( !Get_Connection()->Table_Load(Table, "geometry_columns", "*", Select) || Table.Get_Count() != 1 ) { return( false ); } Select.Printf(SG_T("SELECT UpdateGeometrySRID('%s', '%s', %d)"), Parameters("TABLES")->asString(), Table[0].asString("f_geometry_column"), Get_SRID() ); //----------------------------------------------------- if( !Get_Connection()->Execute(Select) ) { return( false ); } return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:30,
示例9: Error_Set//---------------------------------------------------------bool CXYZ_Import::On_Execute(void){ CSG_File Stream; if( !Stream.Open(Parameters("FILENAME")->asString(), SG_FILE_R) ) { Error_Set(_TL("file could not be opened")); return( false ); } //----------------------------------------------------- CSG_Shapes *pPoints = Parameters("POINTS")->asShapes(); pPoints->Create(SHAPE_TYPE_Point, SG_File_Get_Name(Parameters("FILENAME")->asString(), false)); pPoints->Add_Field("Z", SG_DATATYPE_Double); //----------------------------------------------------- if( Parameters("HEADLINE")->asBool() ) { CSG_String sLine; if( !Stream.Read_Line(sLine) ) { Error_Set(_TL("could not read headline")); return( false ); } } //----------------------------------------------------- sLong Length = Stream.Length(); double x, y, z; while( Stream.Scan(x) && Stream.Scan(y) && Stream.Scan(z) && Set_Progress((double)Stream.Tell(), (double)Length) ) { CSG_Shape *pPoint = pPoints->Add_Shape(); pPoint->Add_Point(x, y); pPoint->Set_Value(0, z); } return( pPoints->Get_Count() > 0 );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:48,
示例10: Parameters//---------------------------------------------------------bool CLines_From_Polygons::On_Execute(void){ CSG_Shapes *pLines, *pPolygons; pPolygons = Parameters("POLYGONS") ->asShapes(); pLines = Parameters("LINES") ->asShapes(); //----------------------------------------------------- if( pPolygons->Get_Count() <= 0 ) { Error_Set(_TL("no polygons in input")); return( false ); } //----------------------------------------------------- pLines->Create(SHAPE_TYPE_Line, pPolygons->Get_Name(), pPolygons, pPolygons->Get_Vertex_Type()); for(int iPolygon=0; iPolygon<pPolygons->Get_Count(); iPolygon++) { CSG_Shape *pPolygon = pPolygons ->Get_Shape(iPolygon); CSG_Shape *pLine = pLines ->Add_Shape(pPolygon, SHAPE_COPY_ATTR); for(int iPart=0; iPart<pPolygon->Get_Part_Count(); iPart++) { for(int iPoint=0; iPoint<pPolygon->Get_Point_Count(iPart); iPoint++) { pLine->Add_Point(pPolygon->Get_Point(iPoint, iPart), iPart); if( pPolygons->Get_Vertex_Type() != SG_VERTEX_TYPE_XY ) { pLine->Set_Z(pPolygon->Get_Z(iPoint, iPart), iPoint, iPart); if( pPolygons->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM ) { pLine->Set_M(pPolygon->Get_M(iPoint, iPart), iPoint, iPart); } } } if( !CSG_Point(pPolygon->Get_Point(0, iPart)).is_Equal(pPolygon->Get_Point(pPolygon->Get_Point_Count(iPart) - 1, iPart)) ) { pLine->Add_Point(pPolygon->Get_Point(0, iPart), iPart); if( pPolygons->Get_Vertex_Type() != SG_VERTEX_TYPE_XY ) { pLine->Set_Z(pPolygon->Get_Z(0, iPart), pLine->Get_Point_Count(iPart) - 1, iPart); if( pPolygons->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM ) { pLine->Set_M(pPolygon->Get_M(0, iPart), pLine->Get_Point_Count(iPart) - 1, iPart); } } } } } return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:60,
示例11: Error_Setstatic const char *Heap_testSuite(){ Error_Set(S_OK); mu_run_test(Heap_Construct_test); mu_run_test(Heap_Alloc_test); mu_run_test(Heap_Alloc_test_NoHeap); return NULL;}
开发者ID:obiwanjacobi,项目名称:Zalt,代码行数:8,
示例12: Parameters//---------------------------------------------------------bool CTable_PCA::On_Execute(void){ CSG_Vector Eigen_Values; CSG_Matrix Eigen_Vectors, Matrix; //----------------------------------------------------- m_pTable = Parameters("TABLE") ->asTable(); m_Method = Parameters("METHOD") ->asInt(); //----------------------------------------------------- if( !Get_Fields() ) { Error_Set(_TL("invalid field selection")); SG_FREE_SAFE(m_Features); return( false ); } if( !Get_Matrix(Matrix) ) { Error_Set(_TL("matrix initialisation failed")); SG_FREE_SAFE(m_Features); return( false ); } if( !SG_Matrix_Eigen_Reduction(Matrix, Eigen_Vectors, Eigen_Values) ) { Error_Set(_TL("Eigen reduction failed")); SG_FREE_SAFE(m_Features); return( false ); } //----------------------------------------------------- Get_Components(Eigen_Vectors, Eigen_Values); //----------------------------------------------------- SG_FREE_SAFE(m_Features); return( true );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:46,
示例13: Parameters//---------------------------------------------------------bool CGrids_Product::On_Execute(void){ //----------------------------------------------------- CSG_Parameter_Grid_List *pGrids = Parameters("GRIDS" )->asGridList(); if( pGrids->Get_Count() < 1 ) { Error_Set(_TL("no grid in list")); return( false ); } //----------------------------------------------------- CSG_Grid *pResult = Parameters("RESULT")->asGrid(); bool bNoData = Parameters("NODATA")->asBool(); //----------------------------------------------------- for(int y=0; y<Get_NY() && Set_Progress(y); y++) { #pragma omp parallel for for(int x=0; x<Get_NX(); x++) { int n = 0; double d = 0.0; for(int i=0; i<pGrids->Get_Count(); i++) { if( pGrids->asGrid(i)->is_InGrid(x, y) ) { if( n++ < 1 ) { d = pGrids->asGrid(i)->asDouble(x, y); } else { d *= pGrids->asGrid(i)->asDouble(x, y); } } } if( bNoData ? n > 0 : n == pGrids->Get_Count() ) { pResult->Set_Value(x, y, d); } else { pResult->Set_NoData(x, y); } } } //----------------------------------------------------- return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:56,
示例14: Error_Set//---------------------------------------------------------bool CGrid_Classify_Supervised::On_Execute(void){ //----------------------------------------------------- if( !Get_Features() ) { Error_Set(_TL("invalid features")); return( false ); } //----------------------------------------------------- CSG_Classifier_Supervised Classifier; if( !Set_Classifier(Classifier) ) { return( false ); } //----------------------------------------------------- CSG_Grid *pClasses = Parameters("CLASSES")->asGrid(); CSG_Grid *pQuality = Parameters("QUALITY")->asGrid(); pClasses->Set_NoData_Value(0); pClasses->Assign(0.0); //----------------------------------------------------- Process_Set_Text(_TL("prediction")); int Method = Parameters("METHOD")->asInt(); for(int y=0; y<Get_NY() && Set_Progress(y); y++) { #pragma omp parallel for for(int x=0; x<Get_NX(); x++) { int Class; double Quality; CSG_Vector Features(m_pFeatures->Get_Count()); if( Get_Features(x, y, Features) && Classifier.Get_Class(Features, Class, Quality, Method) ) { SG_GRID_PTR_SAFE_SET_VALUE(pClasses, x, y, 1 + Class); SG_GRID_PTR_SAFE_SET_VALUE(pQuality, x, y, Quality ); } else { SG_GRID_PTR_SAFE_SET_NODATA(pClasses, x, y); SG_GRID_PTR_SAFE_SET_NODATA(pQuality, x, y); } } } //----------------------------------------------------- return( Set_Classification(Classifier) );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:56,
示例15: Parameters//---------------------------------------------------------bool CSelect_Points::On_Execute(void){ //----------------------------------------------------- m_pPoints = Parameters("POINTS") ->asShapes(); m_pSelection = Parameters("SELECTION") ->asShapes(); m_Radius = Parameters("RADIUS") ->asDouble(); m_MaxPoints = Parameters("MAXNUM") ->asInt(); m_Quadrant = Parameters("QUADRANT") ->asInt() - 1; m_bAddCenter = Parameters("ADDCENTER") ->asBool(); //----------------------------------------------------- if( !m_pPoints->is_Valid() ) { Error_Set(_TL("invalid points layer")); return( false ); } if( m_pPoints->Get_Count() <= 0 ) { Error_Set(_TL("no points in layer")); return( false ); } if( !m_Search.Create(m_pPoints, -1) ) { Error_Set(_TL("failed to initialise search engine")); return( false ); } //----------------------------------------------------- m_pSelection->Create(SHAPE_TYPE_Point, CSG_String::Format(SG_T("%s [%s]"), m_pPoints->Get_Name(), _TL("Selection")), m_pPoints); m_pSelection->Add_Field(_TL("Order") , SG_DATATYPE_Int); m_pSelection->Add_Field(_TL("Distance") , SG_DATATYPE_Double); //----------------------------------------------------- return( true );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:42,
示例16: Parameters//---------------------------------------------------------bool CFlow_by_Slope::On_Execute(void){ m_Slope_Min = Parameters("SLOPE_MIN")->asDouble() * M_DEG_TO_RAD; m_Slope_Max = Parameters("SLOPE_MAX")->asDouble() * M_DEG_TO_RAD; if( m_Slope_Max <= 0.0 ) { Error_Set(_TL("slope threshold must not be zero!")); return( false ); } if( Parameters("B_FLOW")->asBool() ) { m_Flow_Min = Parameters("T_FLOW")->asRange()->Get_LoVal() * Get_Cellarea(); m_Flow_Max = Parameters("T_FLOW")->asRange()->Get_HiVal() * Get_Cellarea(); } else { m_Flow_Min = m_Flow_Max = 0.0; } //----------------------------------------------------- m_pDEM = Parameters("DEM" )->asGrid(); m_pFlow = Parameters("FLOW" )->asGrid(); m_pFlow->Assign(Get_Cellarea()); if( Parameters("WEIGHT")->asGrid() ) { m_pFlow->Multiply(*Parameters("WEIGHT")->asGrid()); } DataObject_Set_Colors(m_pFlow, 11, SG_COLORS_WHITE_BLUE, false); //----------------------------------------------------- for(sLong i=0; i<Get_NCells() && Set_Progress_NCells(i); i++) { int x, y; if( !m_pDEM->Get_Sorted(i, x, y, true) || m_pDEM->is_NoData(x, y) ) { m_pFlow->Set_NoData(x, y); } else { Set_Area(x, y); } } //----------------------------------------------------- return( true );}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:54,
示例17: Error_Set//---------------------------------------------------------bool CLife::On_Execute(void){ //----------------------------------------------------- m_pLife = m_Grid_Target.Get_Grid("LIFE", SG_DATATYPE_Byte); if( !m_pLife ) { Error_Set(_TL("could not create target grid")); return( false ); } //----------------------------------------------------- m_nColors = Parameters("FADECOLOR")->asInt(); for(int y=0; y<m_pLife->Get_NY(); y++) { for(int x=0; x<m_pLife->Get_NX(); x++) { m_pLife->Set_Value(x, y, CSG_Random::Get_Uniform(0, 100) < 50 ? 0 : m_nColors); } } //----------------------------------------------------- m_pLife->Set_Name(_TL("Conway's Game of Life")); m_pLife->Set_NoData_Value(-1); DataObject_Add (m_pLife); DataObject_Set_Colors(m_pLife, 11, SG_COLORS_WHITE_BLUE); DataObject_Update (m_pLife, 0, m_nColors, SG_UI_DATAOBJECT_SHOW); //----------------------------------------------------- int i; m_Count.Create(m_pLife->Get_System(), SG_DATATYPE_Byte); for(i=1; Process_Get_Okay(true) && Next_Cycle(i > m_nColors); i++) { Process_Set_Text(CSG_String::Format("%s: %d", _TL("Life Cycle"), i)); DataObject_Update(m_pLife, 0, m_nColors); } m_Count.Destroy(); //----------------------------------------------------- if( is_Progress() ) { Message_Add(CSG_String::Format("/n%s %d %s/n", _TL("Dead after"), i, _TL("Life Cycles")), false); } return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:54,
示例18: Parameters//---------------------------------------------------------bool CMelton_Ruggedness::On_Execute(void){ CSG_Grid *pDEM, *pArea, *pMRN, *pZMax; //----------------------------------------------------- pDEM = Parameters("DEM" )->asGrid(); pArea = Parameters("AREA")->asGrid(); pZMax = Parameters("ZMAX")->asGrid(); pMRN = Parameters("MRN" )->asGrid(); if( !pDEM->Set_Index() ) { Error_Set(_TL("index creation failed")); return( false ); } pArea->Set_NoData_Value(0.0); pArea->Assign_NoData(); pZMax->Assign_NoData(); pMRN ->Assign_NoData(); //------------------------------------------------- for(sLong n=0; n<Get_NCells() && Set_Progress_NCells(n); n++) { int x, y, i, ix, iy; if( pDEM->Get_Sorted(n, x, y, true, true) ) { pArea->Add_Value(x, y, Get_Cellsize()); if( pZMax->is_NoData(x, y) ) { pZMax->Set_Value(x, y, pDEM->asDouble(x, y)); } if( (i = pDEM->Get_Gradient_NeighborDir(x, y, true)) >= 0 && Get_System().Get_Neighbor_Pos(i, x, y, ix, iy) ) { pArea->Add_Value(ix, iy, pArea->asDouble(x, y)); if( pZMax->is_NoData(ix, iy) || pZMax->asDouble(ix, iy) < pZMax->asDouble(x, y) ) { pZMax->Set_Value(ix, iy, pZMax->asDouble(x, y)); } } pMRN->Set_Value(x, y, (pZMax->asDouble(x, y) - pDEM->asDouble(x, y)) / sqrt(pArea->asDouble(x, y))); } } //----------------------------------------------------- return( true );}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:54,
示例19: Parameters//---------------------------------------------------------bool CGrid_Classify_Supervised::Set_Classifier(CSG_Classifier_Supervised &Classifier){ Classifier.Create(m_pFeatures->Get_Count()); Classifier.Set_Threshold_Distance (Parameters("THRESHOLD_DIST" )->asDouble()); Classifier.Set_Threshold_Angle (Parameters("THRESHOLD_ANGLE")->asDouble() * M_DEG_TO_RAD); Classifier.Set_Threshold_Probability(Parameters("THRESHOLD_PROB" )->asDouble()); Classifier.Set_Probability_Relative (Parameters("RELATIVE_PROB" )->asBool ()); for(int i=0; i<SG_CLASSIFY_SUPERVISED_WTA; i++) { Classifier.Set_WTA(i, Parameters(CSG_String::Format("WTA_%d", i))->asBool()); } //----------------------------------------------------- if( Parameters("TRAINING")->asShapes() != NULL ) // training areas { if( !Set_Classifier(Classifier, Parameters("TRAINING")->asShapes(), Parameters("TRAINING_CLASS")->asInt()) ) { Error_Set(_TL("could not initialize classifier from training areas")); return( false ); } } else // from file { if( !Classifier.Load(Parameters("FILE_LOAD")->asString()) ) { Error_Set(_TL("could not initialize classifier from file")); return( false ); } } //----------------------------------------------------- Message_Add(Classifier.Print(), false); return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:40,
示例20: Parameters//---------------------------------------------------------bool CShapes_Load::On_Execute(void){ CSG_Shapes *pShapes = Parameters("SHAPES")->asShapes(); CSG_String Name = Parameters("TABLES")->asString(); if( !Get_Connection()->Shapes_Load(pShapes, Name) ) { Error_Set(_TL("unable to load vector data from PostGIS database") + CSG_String(":/n") + Name); return( false ); } return( true );}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:15,
示例21: Parameters//---------------------------------------------------------bool CSelect_Grid_From_List::On_Execute(void){ CSG_Parameter_Grid_List *pGrids = Parameters("GRIDS")->asGridList(); if( pGrids->Get_Count() <= 0 ) { Error_Set(_TL("no grids in list")); return( false ); } int Index = Parameters("INDEX")->asInt(); if( Index >= pGrids->Get_Count() ) { Error_Set(_TL("index out of range")); return( false ); } Parameters("GRID")->Set_Value(pGrids->asGrid(Index)); return( true ); }
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:25,
示例22: Parameters//---------------------------------------------------------bool CGrid_Completion::On_Execute(void){ int x, y; double xPos, yPos, Value; TSG_Grid_Interpolation Interpolation; CSG_Grid *pGrid, *pAdditional; pAdditional = Parameters("ADDITIONAL") ->asGrid(); pGrid = Parameters("COMPLETED") ->asGrid(); if( pGrid->is_Intersecting(pAdditional->Get_Extent()) ) { if( pGrid != Parameters("ORIGINAL")->asGrid() ) { Process_Set_Text(_TL("Copying original data...")); pGrid->Assign(Parameters("ORIGINAL")->asGrid()); } Interpolation = (TSG_Grid_Interpolation)Parameters("INTERPOLATION")->asInt(); Process_Set_Text(_TL("Data completion...")); for(y=0, yPos=Get_YMin(); y<Get_NY() && Set_Progress(y, Get_NY()); y++, yPos+=Get_Cellsize()) { if( yPos >= pAdditional->Get_YMin() ) { for(x=0, xPos=Get_XMin(); x<Get_NX() && xPos<=pAdditional->Get_XMax(); x++, xPos+=Get_Cellsize()) { if( pGrid->is_NoData(x, y) && xPos >= pAdditional->Get_XMin() ) { if( !pAdditional->is_NoData_Value(Value = pAdditional->Get_Value(xPos, yPos, Interpolation)) ) { pGrid->Set_Value(x, y, Value); } } } } } return( true ); } Error_Set(_TL("Nothing to do: there is no intersection with additonal grid.")); return( false );}
开发者ID:sinozope,项目名称:SAGA-GIS-git-mirror,代码行数:48,
示例23: Parameters//---------------------------------------------------------bool CSelection_Copy::On_Execute(void){ CSG_Shapes *pInput, *pOutput; pInput = Parameters("INPUT") ->asShapes(); pOutput = Parameters("OUTPUT")->asShapes(); if( pInput->Get_Selection_Count() <= 0 ) { Error_Set(_TL("no shapes in selection")); return( false ); } if( pOutput->Get_Type() != SHAPE_TYPE_Undefined && pOutput->Get_Type() != pInput->Get_Type() && pOutput->Get_Vertex_Type() != pInput->Get_Vertex_Type() ) { Parameters("OUTPUT")->Set_Value(pOutput = SG_Create_Shapes()); } pOutput->Create(pInput->Get_Type(), CSG_String::Format(SG_T("%s [%s]"), pInput->Get_Name(), _TL("Selection")), pInput, pInput->Get_Vertex_Type()); for(int i=0; i<pInput->Get_Selection_Count() && Set_Progress(i, pInput->Get_Selection_Count()); i++) { CSG_Shape *pShape = pInput->Get_Selection(i); pOutput->Add_Shape(pShape); if( pInput->Get_Vertex_Type() > SG_VERTEX_TYPE_XY ) { for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++) { for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++) { pOutput->Get_Shape(i)->Set_Z(pShape->Get_Z(iPoint, iPart), iPoint, iPart); if( pInput->Get_Vertex_Type() == SG_VERTEX_TYPE_XYZM ) { pOutput->Get_Shape(i)->Set_M(pShape->Get_M(iPoint, iPart), iPoint, iPart); } } } } } return( true );}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:47,
注:本文中的Error_Set函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Error_init函数代码示例 C++ Error_Handler函数代码示例 |