📄 grid_orientation.cpp
字号:
///////////////////////////////////////////////////////////
// //
// SAGA //
// //
// System for Automated Geoscientific Analyses //
// //
// Module Library: //
// Grid_Tools //
// //
//-------------------------------------------------------//
// //
// Grid_Orientation.cpp //
// //
// Copyright (C) 2003 by //
// Olaf Conrad //
// //
//-------------------------------------------------------//
// //
// This file is part of 'SAGA - System for Automated //
// Geoscientific Analyses'. SAGA is free software; you //
// can redistribute it and/or modify it under the terms //
// of the GNU General Public License as published by the //
// Free Software Foundation; version 2 of the License. //
// //
// SAGA is distributed in the hope that it will be //
// useful, but WITHOUT ANY WARRANTY; without even the //
// implied warranty of MERCHANTABILITY or FITNESS FOR A //
// PARTICULAR PURPOSE. See the GNU General Public //
// License for more details. //
// //
// You should have received a copy of the GNU General //
// Public License along with this program; if not, //
// write to the Free Software Foundation, Inc., //
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, //
// USA. //
// //
//-------------------------------------------------------//
// //
// e-mail: oconrad@saga-gis.org //
// //
// contact: Olaf Conrad //
// Institute of Geography //
// University of Goettingen //
// Goldschmidtstr. 5 //
// 37077 Goettingen //
// Germany //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#include "Grid_Orientation.h"
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
CGrid_Orientation::CGrid_Orientation(void)
{
//-----------------------------------------------------
// 1. Info...
Set_Name(_TL("Grid Orientation"));
Set_Author(_TL("Copyrights (c) 2001 by Olaf Conrad"));
Set_Description (_TW(
"Copy, mirror (horizontally or vertically) and invert grid values. "
"If the target is not set, the changes will be stored to the original grid. ")
);
//-----------------------------------------------------
// 2. Parameters...
Parameters.Add_Grid(
NULL, "INPUT" , _TL("Grid"),
_TL(""),
PARAMETER_INPUT
);
Parameters.Add_Grid(
NULL, "RESULT" , _TL("Changed Grid"),
_TL(""),
PARAMETER_OUTPUT_OPTIONAL
);
Parameters.Add_Choice(
NULL, "METHOD" , _TL("Method"),
_TL(""),
CSG_String::Format(SG_T("%s|%s|%s|%s|"),
_TL("Copy"),
_TL("Flip"),
_TL("Mirror"),
_TL("Invert")
)
);
}
//---------------------------------------------------------
CGrid_Orientation::~CGrid_Orientation(void)
{}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
bool CGrid_Orientation::On_Execute(void)
{
CSG_Grid *pInput, *pResult;
pInput = Parameters("INPUT")->asGrid();
pResult = Parameters("RESULT")->asGrid();
if( !pResult )
{
pResult = pInput;
Parameters("RESULT")->Set_Value(pInput);
}
else if( pResult != pInput )
{
pResult->Assign(pInput);
}
switch( Parameters("METHOD")->asInt() )
{
case 0: default: // Copy...
break;
case 1: // Flip...
pResult->Flip();
break;
case 2: // Mirror...
pResult->Mirror();
break;
case 3: // Invert...
pResult->Invert();
break;
}
return( true );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -