83 Create(Name, Description, Identifier, bGrid_System);
91 Create(pOwner, Name, Description, Identifier, bGrid_System);
106 void CSG_Parameters::_On_Construction(
void)
118 m_pGrid_System = NULL;
132 m_pOwner = Parameters.m_pOwner;
133 m_pTool = Parameters.m_pTool;
134 m_pManager = Parameters.m_pManager;
136 m_Callback = Parameters.m_Callback;
137 m_bCallback = Parameters.m_bCallback;
139 for(
int i=0; i<Parameters.m_nParameters; i++)
141 _Add(Parameters.m_Parameters[i]);
144 if( Parameters.m_pGrid_System )
149 return( m_nParameters == Parameters.m_nParameters );
172 if(
Create(Name, Description, Identifier, bGrid_System) )
189 m_pGrid_System = NULL;
193 m_References.
Clear();
225 m_pManager = pManager;
243 if( !m_pGrid_System )
268 m_pStack->m_pStack = pStack;
270 m_pManager = pManager;
272 if( bRestoreDefaults )
289 m_pManager = m_pStack->m_pManager;
323 m_Identifier = Identifier;
333 return( m_Identifier.
Cmp(Identifier) == 0 );
353 m_Description = Description;
363 CSG_String Reference(
"<b>" + Authors +
" (" + Year +
"):</b> " + Title +
". " + Where);
367 Reference +=
CSG_String::Format(
" <a href=\"%s\">%s</a>.", Link, Link_Text && *Link_Text ? Link_Text : Link);
372 m_References += Reference;
397 m_References.
Clear();
407 for(
int i=0; i<m_nParameters; i++)
436 return( _Add(pParameter) );
456 return( _Add_Value(ParentID, ID, Name, Description,
false, Type, Value, Minimum, bMinimum, Maximum, bMaximum) );
461 return( _Add_Value(ParentID, ID, Name, Description,
true, Type, Value, 0.0,
false, 0.0,
false) );
503 return( _Add_Range(ParentID, ID, Name, Description,
false, Range_Min, Range_Max, Minimum, bMinimum, Maximum, bMaximum) );
508 return( _Add_Range(ParentID, ID, Name, Description,
true, Range_Min, Range_Max, 0.0,
false, 0.0,
false) );
529 return( pParameter );
544 return( pParameter );
554 return( pParameter );
560 return( _Add_String(ParentID, ID, Name, Description,
false, String, bLongText, bPassword) );
565 return( _Add_String(ParentID, ID, Name, Description,
true, String, bLongText,
false) );
583 return( pParameter );
593 return( pParameter );
605 return( pParameter );
613 if( pInit && *pInit )
621 return( pParameter );
633 return( pParameter );
651 return( pParameter );
663 else if( bSystem_Dependent && m_pGrid_System )
677 return( pParameter );
685 ((
CSG_Parameter_Grid *)pParameter)->Add_Default(Value, Minimum, bMinimum, Maximum, bMaximum);
687 return( pParameter );
697 return( pParameter );
716 return( pParameter );
733 else if( bSystem_Dependent && m_pGrid_System )
747 return( pParameter );
757 return( pParameter );
776 return( pParameter );
811 return( pParameter );
836 return( pParameter );
846 return( pParameter );
854 return( pParameter );
869 return( pParameter );
879 return( pParameter );
889 return( pParameter );
902 return( pParameter );
912 return( pParameter );
920 return( pParameter );
933 return( pParameter );
943 return( pParameter );
951 return( pParameter );
967 return( pParameter );
976 CSG_Parameter * CSG_Parameters::_Add_Value(
const CSG_String &ParentID,
const CSG_String &ID,
const CSG_String &Name,
const CSG_String &Description,
bool bInformation,
TSG_Parameter_Type Type,
double Value,
double Minimum,
bool bMinimum,
double Maximum,
bool bMaximum)
1030 return( pParameter );
1034 CSG_Parameter * CSG_Parameters::_Add_Range(
const CSG_String &ParentID,
const CSG_String &ID,
const CSG_String &Name,
const CSG_String &Description,
bool bInformation,
double Default_Min,
double Default_Max,
double Minimum,
bool bMinimum,
double Maximum,
bool bMaximum)
1037 if( Default_Min > Default_Max )
1039 double d = Default_Min;
1040 Default_Min = Default_Max;
1057 return( pParameter );
1072 return( pParameter );
1082 #include <wx/debug.h>
1083 #include <wx/string.h>
1090 wxASSERT_MSG(!ID.
is_Empty() , wxString::Format(
"CSG_Parameter::_Add(): Parameter ID is empty!"));
1091 wxASSERT_MSG(!
Get_Parameter(ID), wxString::Format(
"CSG_Parameter::_Add(): Parameter ID \"%s\" is already in use!", ID.
c_str()));
1144 m_Parameters[m_nParameters++] = pParameter;
1148 return( pParameter );
1160 pSource->m_Constraint
1165 pParameter->
Assign(pSource);
1168 return( pParameter );
1179 if( i >= 0 && i < m_nParameters )
1181 return( m_Parameters[i] );
1197 if( m_Parameters && !ID.
is_Empty() )
1199 for(
int i=0; i<m_nParameters; i++)
1203 return( m_Parameters[i] );
1208 if( ID.
Find(
'.') > 0 )
1250 if( m_Parameters && iParameter >= 0 && iParameter < m_nParameters )
1254 for(m_nParameters--; iParameter<m_nParameters; iParameter++)
1256 m_Parameters[iParameter] = m_Parameters[iParameter + 1];
1270 for(iParameter=0; iParameter<pParent->m_nChildren; iParameter++)
1272 if( pParent->m_Children[iParameter] == pParameter )
1274 pParent->m_nChildren--;
1276 for( ; iParameter<pParent->m_nChildren; iParameter++)
1278 pParent->m_Children[iParameter] = pParent->m_Children[iParameter + 1];
1297 if( m_Parameters && Identifier.
Length() )
1299 for(
int i=0; i<m_nParameters; i++)
1301 if( !m_Parameters[i]->m_Identifier.
Cmp(Identifier) )
1314 if( m_nParameters > 0 )
1316 m_pGrid_System = NULL;
1318 for(
int i=0; i<m_nParameters; i++)
1320 delete(m_Parameters[i]);
1325 m_Parameters = NULL;
1346 m_Callback = Callback;
1348 for(
int i=0; i<m_nParameters; i++)
1365 bool bPrevious = m_bCallback;
1367 m_bCallback = bActive;
1369 for(
int i=0; i<m_nParameters; i++)
1377 return( bPrevious );
1381 bool CSG_Parameters::_On_Parameter_Changed(
CSG_Parameter *pParameter,
int Flags)
1383 if( m_Callback && m_bCallback )
1387 m_Callback(pParameter, Flags);
1488 if( m_Parameters[i]->is_DataObject() )
1492 else if( m_Parameters[i]->is_DataObject_List() )
1512 return( pSource && pSource !=
this &&
Create(*pSource) );
1518 if( !pSource || pSource ==
this )
1526 for(
int i=0; i<pSource->
Get_Count(); i++)
1542 if( !pSource || pSource ==
this )
1550 for(
int i=0; i<pSource->m_nParameters; i++)
1552 _Add(pSource->m_Parameters[i]);
1554 if( m_Parameters[i]->asParameters() )
1560 if( pSource->m_pGrid_System )
1565 return( m_nParameters == pSource->m_nParameters );
1581 if( m_Parameters[i]->Check(bSilent) == false )
1590 if( !bResult && !bSilent )
1599 bool CSG_Parameters::DataObjects_Create(
void)
1601 bool bResult =
true;
1603 for(
int i=0; bResult && i<
Get_Count(); i++)
1656 else if( m_pManager && !m_pManager->
Exists(pObject) )
1677 default : pObject = NULL ;
break;
1722 m_pManager->
Add(pObject);
1750 bool CSG_Parameters::DataObjects_Synchronize(
void)
1777 if( m_pManager && !m_pManager->Delete(pObject) )
1788 m_pManager->Add(pObject);
1804 for(
int j=0; j<P.
asList()->Get_Item_Count(); j++)
1810 m_pManager->Add(pObject);
1828 bool CSG_Parameters::DataObjects_Get_Projection(
CSG_Projection &Projection)
const
1838 p->
asParameters()->DataObjects_Get_Projection(Projection);
1859 return( Projection.
is_Okay() );
1863 bool CSG_Parameters::DataObjects_Set_Projection(
const CSG_Projection &Projection)
1878 p->
asParameters()->DataObjects_Set_Projection(Projection);
1910 bool bResult =
false;
1914 if( m_pGrid_System )
1949 bOptionsOnly ?
_TL(
"Options") :
_TL(
"Parameters")),
1979 else if( P.is_Parameters() )
1981 P.asParameters()->Set_History(MetaData,
true,
false);
2083 return( m_pGrid_System && m_pGrid_System->
asGrid_System() && m_pGrid_System->
Set_Value((
void *)&System) );
2117 if( pParameter && pParameter->
Serialize(*Data(i),
false) )
2170 while( Stream.
Read_Line(sLine) && sLine.
Cmp(
"[PARAMETER_ENTRIES_BEGIN]") );
2172 if( sLine.
Cmp(
"[PARAMETER_ENTRIES_BEGIN]") )
2178 while( Stream.
Read_Line(sLine) && sLine.
Cmp(
"[PARAMETER_ENTRIES_END]") )
2180 if( !sLine.
Cmp(
"[PARAMETER_ENTRY_BEGIN]")
2190 switch( sLine.
asInt() )
2217 while( Stream.
Read_Line(sLine) && sLine.
Cmp(
"[TEXT_ENTRY_END]") )
2225 Stream.
Read(&i,
sizeof(i));
2241 Stream.
Read(&d,
sizeof(d));
2242 Stream.
Read(&r,
sizeof(r));
2253 if( !sLine.
Cmp(
"[ENTRY_DATAOBJECT_CREATE]") )
2259 pParameter->
Set_Value(m_pManager ? m_pManager->Find(sLine) : NULL);
2268 while( Stream.
Read_Line(sLine) && sLine.
Cmp(
"[ENTRY_DATAOBJECTLIST_END]") )
2270 CSG_Data_Object *pObject = m_pManager ? m_pManager->Find(sLine) : NULL;