本文整理汇总了C++中Process_Set_Text函数的典型用法代码示例。如果您正苦于以下问题:C++ Process_Set_Text函数的具体用法?C++ Process_Set_Text怎么用?C++ Process_Set_Text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Process_Set_Text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Get_Resampling
//---------------------------------------------------------
bool CPanSharp_Brovey::On_Execute(void)
{
//-----------------------------------------------------
TSG_Grid_Resampling Resampling = Get_Resampling(Parameters("RESAMPLING")->asInt());
//-----------------------------------------------------
CSG_Grid *pPan = Parameters("PAN")->asGrid();
//-----------------------------------------------------
Process_Set_Text("%s: %s ...", _TL("Resampling"), Parameters("R")->asGrid()->Get_Name());
CSG_Grid *pR = Parameters("R_SHARP")->asGrid();
pR->Assign (Parameters("R")->asGrid(), Resampling);
pR->Set_Name(Parameters("R")->asGrid()->Get_Name());
Process_Set_Text("%s: %s ...", _TL("Resampling"), Parameters("G")->asGrid()->Get_Name());
CSG_Grid *pG = Parameters("G_SHARP")->asGrid();
pG->Assign (Parameters("G")->asGrid(), Resampling);
pG->Set_Name(Parameters("G")->asGrid()->Get_Name());
Process_Set_Text("%s: %s ...", _TL("Resampling"), Parameters("B")->asGrid()->Get_Name());
CSG_Grid *pB = Parameters("B_SHARP")->asGrid();
pB->Assign (Parameters("B")->asGrid(), Resampling);
pB->Set_Name(Parameters("B")->asGrid()->Get_Name());
//-----------------------------------------------------
Process_Set_Text(_TL("Sharpening"));
for(int y=0; y<pPan->Get_NY() && Set_Progress(y, pPan->Get_NY()); y++)
{
#pragma omp parallel for
for(int x=0; x<pPan->Get_NX(); x++)
{
if( !pPan->is_NoData(x, y) && !pR->is_NoData(x, y) && !pG->is_NoData(x, y) && !pB->is_NoData(x, y) )
{
double k = (pR->asDouble(x, y) + pG->asDouble(x, y) + pB->asDouble(x, y));
if( k != 0.0 )
{
k = pPan->asDouble(x, y) / k;
}
pR->Mul_Value(x, y, k);
pG->Mul_Value(x, y, k);
pB->Mul_Value(x, y, k);
}
else
{
pR->Set_NoData(x, y);
pG->Set_NoData(x, y);
pB->Set_NoData(x, y);
}
}
}
//-----------------------------------------------------
return( true );
}
示例2: Process_Set_Text
//---------------------------------------------------------
void CD8_Flow_Analysis::Get_Basins(void)
{
Process_Set_Text(_TL("Drainage Basins"));
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
Get_Basin(x, y);
}
}
//-----------------------------------------------------
CSG_Shapes *pBasins = Parameters("BASINS")->asShapes();
if( pBasins )
{
bool bResult;
SG_RUN_MODULE(bResult, "shapes_grid", 6,
pModule->Get_Parameters()->Set_Parameter(SG_T("GRID") , m_pBasins)
&& pModule->Get_Parameters()->Set_Parameter(SG_T("POLYGONS"), pBasins)
)
pBasins->Set_Name(_TL("Drainage Basins"));
}
}
示例3: Parameters
//---------------------------------------------------------
bool CGDAL_Export_GeoTIFF::On_Execute(void)
{
CSG_String File_Name, Options;
CSG_Projection Projection;
CSG_Parameter_Grid_List *pGrids;
CSG_GDAL_DataSet DataSet;
//-----------------------------------------------------
pGrids = Parameters("GRIDS") ->asGridList();
File_Name = Parameters("FILE") ->asString();
Options = Parameters("OPTIONS") ->asString();
Get_Projection(Projection);
//-----------------------------------------------------
if( !DataSet.Open_Write(File_Name, SG_T("GTiff"), Options, SG_Get_Grid_Type(pGrids), pGrids->Get_Count(), *Get_System(), Projection) )
{
return( false );
}
//-----------------------------------------------------
for(int i=0; i<pGrids->Get_Count(); i++)
{
Process_Set_Text(CSG_String::Format(SG_T("%s %d"), _TL("Band"), i + 1));
DataSet.Write(i, pGrids->asGrid(i));
}
if( !DataSet.Close() )
{
return( false );
}
return( true );
}
示例4: DEM
//---------------------------------------------------------
bool CHillslope_Evolution_FTCS::On_Execute(void)
{
//-----------------------------------------------------
CSG_Grid DEM(Get_System());
m_pDEM_Old = &DEM;
m_pDEM = Parameters("MODEL")->asGrid();
m_pDEM->Assign(Parameters("DEM")->asGrid());
DataObject_Set_Colors(Parameters("DIFF")->asGrid(), 10, SG_COLORS_RED_GREY_BLUE, true);
//-----------------------------------------------------
double k, dTime, nTime;
k = Parameters("KAPPA" )->asDouble();
nTime = Parameters("DURATION")->asDouble();
if( Parameters("TIMESTEP")->asInt() == 0 )
{
dTime = Parameters("DTIME")->asDouble();
}
else
{
dTime = 0.5 * Get_Cellarea() / (2.0 * k);
if( Parameters("NEIGHBOURS")->asInt() == 1 )
{
dTime /= sqrt(2.0);
}
}
if( dTime > nTime )
{
Message_Fmt("\n%s: %s [%f]", _TL("Warning"), _TL("Time step exceeds duration"), dTime);
dTime = nTime;
}
Message_Fmt("\n%s: %f", _TL("Time Step"), dTime);
Message_Fmt("\n%s: %d", _TL("Steps"), (int)(nTime / dTime));
//-----------------------------------------------------
for(double iTime=dTime; iTime<=nTime && Set_Progress(iTime, nTime); iTime+=dTime)
{
Process_Set_Text("%s: %.2f [%.2f]", _TL("Simulation Time"), iTime, nTime);
SG_UI_Progress_Lock(true);
Set_Diffusion(dTime * k / Get_Cellarea());
Set_Difference();
SG_UI_Progress_Lock(false);
}
//-----------------------------------------------------
return( true );
}
示例5: Parameters
//---------------------------------------------------------
bool CExercise_10::On_Execute(void)
{
bool bAlive;
int x, y, i;
CSG_Colors Colors;
//-----------------------------------------------------
// General initialisations...
m_pLife = Parameters("RESULT")->asGrid();
m_nColors = Parameters("COLORS")->asInt();
Colors.Set_Count(m_nColors + 1);
Colors.Set_Ramp(SG_GET_RGB(127, 127, 127), SG_GET_RGB(0, 0, 0));
Colors.Set_Color(0, SG_GET_RGB(255, 255, 255));
DataObject_Set_Colors(m_pLife, Colors);
//-----------------------------------------------------
// Initialise life's world...
if( Parameters("REFRESH")->asBool() )
{
srand((unsigned)time(NULL));
for(y=0; y<Get_NY(); y++)
{
for(x=0; x<Get_NX(); x++)
{
m_pLife->Set_Value(x, y, rand() > RAND_MAX / 2 ? 0 : 1);
}
}
}
//-----------------------------------------------------
// Execution...
m_pTemp = SG_Create_Grid(m_pLife, SG_DATATYPE_Byte);
for(i=1, bAlive=true; bAlive && Process_Get_Okay(true); i++)
{
Process_Set_Text(CSG_String::Format(SG_T("%d %s"), i, _TL("Life Cycle")));
if( (bAlive = Next_Step()) == false )
{
Message_Add(CSG_String::Format(SG_T("%s %d %s\n"), _TL("Dead after"), i, _TL("Life Cycles")));
}
}
delete(m_pTemp);
//-----------------------------------------------------
// Finish...
return( true );
}
示例6: 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 );
}
示例7: BA_Get_Value
//---------------------------------------------------------
bool CGridding_Spline_MBA_Grid::_Get_Difference(CSG_Grid &Phi)
{
int xPoint, yPoint, nErrors;
double x, y, z, zMax, zMean;
TSG_Point_Z p;
CSG_String s;
//-----------------------------------------------------
for(yPoint=0, p.y=m_Points.Get_YMin(), zMax=0.0, nErrors=0, zMean=0.0; yPoint<m_Points.Get_NY() && Set_Progress(yPoint, m_Points.Get_NY()); yPoint++, p.y+=m_Points.Get_Cellsize())
{
for(xPoint=0, p.x=m_Points.Get_XMin(); xPoint<m_Points.Get_NX(); xPoint++, p.x+=m_Points.Get_Cellsize())
{
if( !m_Points.is_NoData(xPoint, yPoint) )
{
x = (p.x - Phi.Get_XMin()) / Phi.Get_Cellsize();
y = (p.y - Phi.Get_YMin()) / Phi.Get_Cellsize();
z = m_Points.asDouble(xPoint, yPoint) - BA_Get_Value(x, y, Phi);
m_Points.Set_Value(xPoint, yPoint, z);
if( (z = fabs(z)) > m_Epsilon )
{
nErrors ++;
zMean += fabs(z);
if( fabs(z) > zMax )
{
zMax = fabs(z);
}
}
else
{
// m_Points.Set_Value(xPoint, yPoint, 0.0);
m_Points.Set_NoData(xPoint, yPoint);
}
}
}
}
if( nErrors > 0 )
{
zMean /= nErrors;
}
//-----------------------------------------------------
int i = 1 + (int)(0.5 + log(Phi.Get_NX() - 4.0) / log(2.0));
s.Printf(SG_T("%s:%d, %s:%d, %s:%f, %s:%f"),
_TL("level"), i,
_TL("error"), nErrors,
_TL("max") , zMax,
_TL("mean") , zMean
);
Process_Set_Text(s);
Message_Add (s);
return( zMax >= m_Epsilon && i < m_Level_Max && Process_Get_Okay(false) );
}
示例8: Parameters
//---------------------------------------------------------
bool CTopographic_Correction::Get_Model(void)
{
//-----------------------------------------------------
m_pOriginal = Parameters("ORIGINAL") ->asGrid();
m_pCorrected = Parameters("CORRECTED") ->asGrid();
m_pCorrected ->Set_Name(CSG_String::Format(SG_T("%s [%s]"), m_pOriginal->Get_Name(), _TL("Topographic Correction")));
m_Method = Parameters("METHOD") ->asInt();
m_Minnaert = Parameters("MINNAERT") ->asDouble();
switch( Parameters("MAXVALUE")->asInt() )
{
default: m_maxValue = 255; break;
case 1: m_maxValue = 65535; break;
}
switch( m_Method )
{
//-----------------------------------------------------
case 5: // C Correction
{
Process_Set_Text(_TL("Regression Analysis"));
CSG_Regression R;
sLong n = Parameters("MAXCELLS")->asInt();
int nStep = Get_NCells() < n ? 1 : (int)(Get_NCells() / n);
for(n=0; n<Get_NCells() && Set_Progress_NCells(n); n+=nStep)
{
R.Add_Values(m_pOriginal->asDouble(n), m_Illumination.asDouble(n));
}
if( !R.Calculate() || !R.Get_Constant() )
{
return( false );
}
m_C = R.Get_Coefficient() / R.Get_Constant();
Message_Add(R.asString());
}
break;
//-----------------------------------------------------
case 6: // Normalization (after Civco, modified by Law & Nichol)
{
m_C = 1.0;
}
break;
}
//-----------------------------------------------------
return( true );
}
示例9: Parameters
//---------------------------------------------------------
bool CSRTM30_Import::On_Execute(void)
{
char x_sTile[9][5] = { "W180", "W140", "W100", "W060", "W020", "E020", "E060", "E100", "E140" },
y_sTile[3][4] = { "S10", "N40", "N90" };
double dSize = 30.0 / (60.0 * 60.0);
//-----------------------------------------------------
int xTile, yTile;
double xMin, xMax, yMin, yMax;
TSG_Rect rOut, rTile;
CSG_String sTile;
CSG_Grid *pOut;
//-----------------------------------------------------
xMin = Parameters("XMIN")->asInt();
xMax = Parameters("XMAX")->asInt();
yMin = Parameters("YMIN")->asInt();
yMax = Parameters("YMAX")->asInt();
rOut.xMin = (180 + xMin) / 40.0 * X_WIDTH;
rOut.xMax = rOut.xMin + (int)((xMax - xMin) / dSize);
rOut.yMin = ( 60 + yMin) / 50.0 * Y_WIDTH;
rOut.yMax = rOut.yMin + (int)((yMax - yMin) / dSize);
//-----------------------------------------------------
pOut = SG_Create_Grid(SG_DATATYPE_Short,
(int)(rOut.xMax - rOut.xMin),
(int)(rOut.yMax - rOut.yMin),
dSize,
xMin + 0.5 * dSize,
yMin + 0.5 * dSize
);
pOut->Set_NoData_Value(-9999);
pOut->Assign_NoData();
pOut->Set_Name(SG_T("SRTM30"));
pOut->Get_Projection().Create(SG_T("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"));
//-----------------------------------------------------
for(yTile=0, rTile.yMin=0, rTile.yMax=Y_WIDTH; yTile<3; yTile++, rTile.yMin+=Y_WIDTH, rTile.yMax+=Y_WIDTH)
{
for(xTile=0, rTile.xMin=0, rTile.xMax=X_WIDTH; xTile<9; xTile++, rTile.xMin+=X_WIDTH, rTile.xMax+=X_WIDTH)
{
sTile.Printf(SG_T("Tile: %s%s"), x_sTile[xTile], y_sTile[yTile]);
Process_Set_Text(sTile);
sTile.Printf(SG_T("%s%s%s.dem"), Parameters("PATH")->asString(), x_sTile[xTile], y_sTile[yTile]);
Tile_Load(sTile, rTile, pOut, rOut);
}
}
//-----------------------------------------------------
Parameters("GRID")->Set_Value(pOut);
return( true );
}
示例10: Get_Insolation
//---------------------------------------------------------
bool CSADO_SolarRadiation::Get_Insolation(void)
{
//-----------------------------------------------------
if( Initialise() )
{
if( m_bMoment )
{
Get_Insolation(m_Day_A, m_Hour);
Finalise();
}
//-------------------------------------------------
else
{
for(int Day=m_Day_A; Day<=m_Day_B && Process_Get_Okay(false); Day+=m_dDays)
{
for(double Hour=m_Hour; Hour<24.0 && Process_Get_Okay(false); Hour+=m_dHour)
{
Process_Set_Text(CSG_String::Format(SG_T("%s: %d(%d-%d), %s: %f"), _TL("Day"), Day, m_Day_A, m_Day_B, _TL("Hour"), Hour));
if( m_bUpdateDirect ) m_pSumDirect->Assign(0.0);
if( m_bUpdateDiffus ) m_pSumDiffus->Assign(0.0);
if( m_bUpdateTotal ) m_pSumTotal ->Assign(0.0);
if( Get_Insolation(Day, Hour) )
{
if( m_bUpdateDirect )
{
m_TmpDirect += *m_pSumDirect;
DataObject_Update(m_pSumDirect);
}
if( m_bUpdateDiffus )
{
m_TmpDiffus += *m_pSumDiffus;
DataObject_Update(m_pSumDiffus);
}
if( m_bUpdateTotal )
{
m_TmpTotal += *m_pSumTotal;
DataObject_Update(m_pSumTotal);
}
}
}
}
Finalise(m_dHour / (24.0 * (1 + m_Day_B - m_Day_A))); // *m_pSumDirect *= m_dHour / D->size();
}
}
//-----------------------------------------------------
return( true );
}
示例11: 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) );
}
示例12: 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 );
}
示例13: return
//---------------------------------------------------------
bool CCRS_Transform_Shapes::Transform(CSG_Shapes *pSource, CSG_Shapes *pTarget)
{
if( !pTarget || !pSource || !pSource->is_Valid() )
{
return( false );
}
if( !m_Projector.Set_Source(pSource->Get_Projection()) )
{
return( false );
}
int nDropped = 0;
Process_Set_Text(CSG_String::Format(SG_T("%s: %s"), _TL("Processing"), pSource->Get_Name()));
for(int iShape=0; iShape<pSource->Get_Count() && Set_Progress(iShape, pSource->Get_Count()); iShape++)
{
CSG_Shape *pShape_Source = pSource->Get_Shape(iShape);
CSG_Shape *pShape_Target = pTarget->Add_Shape(pShape_Source, SHAPE_COPY_ATTR);
for(int iPart=0; iPart<pShape_Source->Get_Part_Count() && pShape_Target; iPart++)
{
for(int iPoint=0; iPoint<pShape_Source->Get_Point_Count(iPart) && pShape_Target; iPoint++)
{
TSG_Point Point = pShape_Source->Get_Point(iPoint, iPart);
if( m_Projector.Get_Projection(Point.x, Point.y) )
{
pShape_Target->Add_Point(Point.x, Point.y, iPart);
}
else
{
nDropped++;
pTarget->Del_Shape(pShape_Target);
pShape_Target = NULL;
}
}
}
}
if( nDropped > 0 )
{
Message_Add(CSG_String::Format(SG_T("%s: %d %s"), pTarget->Get_Name(), nDropped, _TL("shapes have been dropped")));
}
pTarget->Get_Projection() = m_Projector.Get_Target();
return( pTarget->Get_Count() > 0 );
}
示例14: Process_Set_Text
//---------------------------------------------------------
bool CPROJ4_Shapes::_Get_Conversion(CSG_Shapes *pSource, CSG_Shapes *pTarget)
{
if( pSource && pSource->is_Valid() && pTarget )
{
int nDropped = 0;
Process_Set_Text(CSG_String::Format(SG_T("%s: %s"), _TL("Processing"), pSource->Get_Name()));
pTarget->Create(pSource->Get_Type(), CSG_String::Format(SG_T("%s [%s]"), pSource->Get_Name(), Get_Proj_Name().c_str()), pSource);
for(int iShape=0; iShape<pSource->Get_Count() && Set_Progress(iShape, pSource->Get_Count()); iShape++)
{
CSG_Shape *pShape_Source = pSource->Get_Shape(iShape);
CSG_Shape *pShape_Target = pTarget->Add_Shape(pShape_Source, SHAPE_COPY_ATTR);
bool bDropped = false;
for(int iPart=0; iPart<pShape_Source->Get_Part_Count() && !bDropped; iPart++)
{
for(int iPoint=0; iPoint<pShape_Source->Get_Point_Count(iPart) && !bDropped; iPoint++)
{
TSG_Point Point = pShape_Source->Get_Point(iPoint, iPart);
if( Get_Converted(Point.x, Point.y) )
{
pShape_Target->Add_Point(Point.x, Point.y, iPart);
}
else
{
bDropped = true;
}
}
}
if( bDropped )
{
nDropped++;
pTarget->Del_Shape(pShape_Target);
}
}
if( nDropped > 0 )
{
Message_Add(CSG_String::Format(SG_T("%d %s"), nDropped, _TL("shapes have been dropped")));
}
return( pTarget->Get_Count() > 0 );
}
return( false );
}
示例15: Parameters
//---------------------------------------------------------
bool CShapes_Split::On_Execute(void)
{
int x, y, nx, ny, Method;
CSG_Shapes *pShapes, *pCut, *pExtent;
//-----------------------------------------------------
pShapes = Parameters("SHAPES") ->asShapes();
pExtent = Parameters("EXTENT") ->asShapes();
nx = Parameters("NX") ->asInt();
ny = Parameters("NY") ->asInt();
Method = Parameters("METHOD") ->asInt();
Parameters("CUTS")->asShapesList()->Del_Items();
//-----------------------------------------------------
if( pShapes->is_Valid() )
{
double dx, dy;
TSG_Rect r;
dx = pShapes->Get_Extent().Get_XRange() / nx;
dy = pShapes->Get_Extent().Get_YRange() / ny;
for(y=0; y<ny && Process_Get_Okay(false); y++)
{
r.yMin = pShapes->Get_Extent().Get_YMin() + y * dy;
r.yMax = r.yMin + dy;
for(x=0; x<nx && Process_Get_Okay(false); x++)
{
r.xMin = pShapes->Get_Extent().Get_XMin() + x * dx;
r.xMax = r.xMin + dx;
Cut_Set_Extent(r, pExtent, y == 0 && x == 0);
Process_Set_Text(CSG_String::Format(SG_T("%d/%d"), y * nx + (x + 1), nx * ny));
if( (pCut = Cut_Shapes(r, Method, pShapes)) != NULL )
{
pCut->Set_Name(CSG_String::Format(SG_T("%s [%d][%d]"), pShapes->Get_Name(), 1 + x, 1 + y));
Parameters("CUTS")->asShapesList()->Add_Item(pCut);
}
}
}
return( true );
}
return( false );
}