Beispiel #1
0
	bool					Del_Edge			(int ID)
	{
		int	n	= 0;

		for(int i=m_Edges.Get_Count()-1; i>=0; i--)
		{
			if( m_Edges[i].asInt(0) == ID )
			{
				m_Edges.Del_Record(i);

				n++;
			}
		}

		if( n > 0 )
		{
			m_Edges.Set_Index(1, TABLE_INDEX_Ascending);

			return( true );
		}

		return( false );
	}
//---------------------------------------------------------
bool CTL_Merge::On_Execute(void)
{
	CSG_String	Target	= Parameters("TARGET")->asString();
	CSG_Strings	Files;

	if( !Parameters("FILES")->asFilePath()->Get_FilePaths(Files) || Files.Get_Count() <= 1 )
	{
		Error_Set(SG_T("no files to merge"));

		return( false );
	}

	//-----------------------------------------------------
	int			i, j;
	CSG_Table	Merge;

	if( !Merge.Create(Files[0], TABLE_FILETYPE_Text) )
	{
		Merge.Destroy();

		Merge.Add_Field(SG_T("ORIGINAL")	, SG_DATATYPE_String);
		Merge.Add_Field(SG_T("TRANSLATION")	, SG_DATATYPE_String);

	}

	Merge.Save(Target, TABLE_FILETYPE_Text);

	//-----------------------------------------------------
	for(i=1; i<Files.Get_Count() && Process_Get_Okay(); i++)
	{
		CSG_Translator	Translator(Target, false);
		CSG_Table		Add(Target, TABLE_FILETYPE_Text);

		if( Merge.Create(Files[i], TABLE_FILETYPE_Text) )
		{
			for(j=0; j<Merge.Get_Count() && Set_Progress(j, Merge.Get_Count()); j++)
			{
				if( !Translator.Get_Translation(Merge[j].asString(0), true) )
				{
					Add.Add_Record(Merge.Get_Record(j));
				}
			}

			if( Add.Get_Count() > Translator.Get_Count() )
			{
				Add.Save(Target, TABLE_FILETYPE_Text);
			}
		}
	}

	//-----------------------------------------------------
	for(i=Merge.Get_Count()-1; i>0 && Process_Get_Okay(); i--)
	{
		if( !SG_STR_CMP(Merge[i].asString(0), Merge[i - 1].asString(0)) )
		{
			Merge.Del_Record(i);
		}
	}

	//-----------------------------------------------------
	return( true );
}
//---------------------------------------------------------
bool CPC_Cluster_Analysis::On_Execute(void)
{
	int				nCluster;
	long			nElements;
	double			SP;
	CSG_Parameters Parms;

	m_bUpdateView = false;

	//-----------------------------------------------------
	nCluster	= Parameters("NCLUSTER")->asInt();
	pInput		= Parameters("PC_IN")	->asPointCloud();
	pResult		= Parameters("PC_OUT")	->asPointCloud();

	if( SG_UI_Get_Window_Main() )
		m_bUpdateView = Parameters("UPDATEVIEW")->asBool();

	//-------------------------------------------------
	m_Features	= (int *)Parameters("FIELDS")->asPointer();
	m_nFeatures	=        Parameters("FIELDS")->asInt    ();

	if( !m_Features || m_nFeatures <= 0 )
	{
		Error_Set(_TL("no features in selection"));

		return( false );
	}


	//-----------------------------------------------------
	pResult->Create(pInput);
	pResult->Set_Name(CSG_String::Format(SG_T("%s_cluster"), pInput->Get_Name()));
	pResult->Add_Field(SG_T("CLUSTER"), SG_DATATYPE_Int);
	DataObject_Update(pResult);

	pResult->Set_NoData_Value(-1.0);
	clustField	= pResult->Get_Field_Count() - 1;


	//-----------------------------------------------------
	Process_Set_Text(_TL("Initializing ..."));

	for( int i=0; i<m_nFeatures; i++ )
		vValues.push_back( std::vector<double>() );

	for( int i=0; i<pInput->Get_Record_Count() && SG_UI_Process_Set_Progress(i, pInput->Get_Record_Count()); i++ )
	{
		pResult->Add_Point(pInput->Get_X(i), pInput->Get_Y(i), pInput->Get_Z(i));

		for( int j=0; j<pInput->Get_Attribute_Count(); j++ )
			pResult->Set_Attribute(i, j, pInput->Get_Attribute(i, j));

		pResult->Set_NoData(i, clustField);
		
		bool bNoData = false;

		for( int j=0; j<m_nFeatures; j++)
		{
			if( pInput->is_NoData(i, m_Features[j]) )
			{
				bNoData = true;
				break;
			}
		}

		if( !bNoData )
		{
			for( int j=0; j<m_nFeatures; j++ )
			{
				if( Parameters("NORMALISE")->asBool() )
					vValues.at(j).push_back( (pInput->Get_Value(i, m_Features[j]) - pInput->Get_Mean(m_Features[j])) / pInput->Get_StdDev(m_Features[j]) );
				else
					vValues.at(j).push_back(pInput->Get_Value(i, m_Features[j]));
			}
		}
		else
		{
			for( int j=0; j<m_nFeatures; j++ )
			{
				vValues.at(j).push_back(pInput->Get_NoData_Value());
			}
		}
	}


	if( m_bUpdateView )
	{
		if( DataObject_Get_Parameters(pResult, Parms) && Parms("COLORS_TYPE") && Parms("METRIC_ATTRIB") && Parms("METRIC_COLORS") && Parms("METRIC_ZRANGE") )
		{
			Parms("COLORS_TYPE")					->Set_Value(2);			// graduated color
			Parms("METRIC_COLORS")->asColors()		->Set_Count(nCluster);
			Parms("METRIC_ATTRIB")					->Set_Value(clustField);
			Parms("METRIC_ZRANGE")->asRange()		->Set_Range(0, nCluster);
		}
		DataObject_Set_Parameters(pResult, Parms);
		DataObject_Update(pResult, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
	}


	nMembers	= (int     *)SG_Malloc(nCluster * sizeof(int));
	Variances	= (double  *)SG_Malloc(nCluster * sizeof(double));
	Centroids	= (double **)SG_Malloc(nCluster * sizeof(double *));

	for( int i=0; i<nCluster; i++ )
	{
		Centroids[i]	= (double  *)SG_Malloc(m_nFeatures * sizeof(double));
	}

	//-------------------------------------------------
	nElements	= pInput->Get_Point_Count();

	switch( Parameters("METHOD")->asInt() )
	{
	case 0:
		SP	= MinimumDistance	(nElements, nCluster);
		break;

	case 1:
		SP	= HillClimbing		(nElements, nCluster);
		break;

	case 2:
		SP	= MinimumDistance	(nElements, nCluster);

		nElements	= pInput->Get_Point_Count();	// may have been diminished because of no data values...

		SP	= HillClimbing		(nElements, nCluster);
		break;
	}

	//-------------------------------------------------
	if( Parameters("NORMALISE")->asBool() )
	{
		int		iv = 0;

		for( int i=0; i<m_nFeatures; i++ )
		{
			for( int j=0; j<nCluster; j++ )
			{
				Centroids[j][iv]	= sqrt(pInput->Get_Variance(m_Features[i])) * Centroids[j][iv] + pInput->Get_Mean(m_Features[i]);
			}

			iv++;
		}
	}

	Write_Result(Parameters("STATISTICS")->asTable(), nElements, nCluster, SP);

	//-------------------------------------------------
	if( DataObject_Get_Parameters(pResult, Parms) && Parms("COLORS_TYPE") && Parms("LUT") && Parms("LUT_ATTRIB") )
	{
		CSG_Table_Record	*pClass;
		CSG_Table			*pLUT	= Parms("LUT")->asTable();

		for( int i=0; i<nCluster; i++ )
		{
			if( (pClass = pLUT->Get_Record(i)) == NULL )
			{
				pClass	= pLUT->Add_Record();
				pClass->Set_Value(0, SG_GET_RGB(rand() * 255.0 / RAND_MAX, rand() * 255.0 / RAND_MAX, rand() * 255.0 / RAND_MAX));
			}

			pClass->Set_Value(1, CSG_String::Format(SG_T("%s %d"), _TL("Class"), i));
			pClass->Set_Value(2, CSG_String::Format(SG_T("%s %d"), _TL("Class"), i));
			pClass->Set_Value(3, i);
			pClass->Set_Value(4, i);
		}

		while( pLUT->Get_Record_Count() > nCluster )
		{
			pLUT->Del_Record(pLUT->Get_Record_Count() - 1);
		}

		Parms("COLORS_TYPE")	->Set_Value(1);	// Color Classification Type: Lookup Table
		Parms("LUT_ATTRIB")		->Set_Value(clustField);

		DataObject_Set_Parameters(pResult, Parms);
	}

	//-------------------------------------------------
	for( int i=0; i<nCluster; i++ )
	{
		SG_Free(Centroids[i]);
	}

	SG_Free(Centroids);
	SG_Free(Variances);
	SG_Free(nMembers);

	vValues.clear();

	return( true );
}
Beispiel #4
0
//---------------------------------------------------------
bool CSoil_Texture::On_Execute(void)
{
	CSG_Grid	*pSand, *pSilt, *pClay, *pTexture, *pSum;

	//-----------------------------------------------------
	pSand		= Parameters("SAND")	->asGrid();
	pSilt		= Parameters("SILT")	->asGrid();
	pClay		= Parameters("CLAY")	->asGrid();
	pTexture	= Parameters("TEXTURE")	->asGrid();
	pSum		= Parameters("SUM")		->asGrid();

	//-----------------------------------------------------
	if( (pSand ? 1 : 0) + (pSilt ? 1 : 0) + (pClay ? 1 : 0) < 2 )
	{
		Error_Set(_TL("at least two contents (sand, silt, clay) have to be given"));

		return( false );
	}

	//-----------------------------------------------------
	pTexture->Set_NoData_Value(0.0);

	CSG_Parameters	P;

	if( DataObject_Get_Parameters(pTexture, P) && P("COLORS_TYPE") && P("LUT") )
	{
		CSG_Table	*pLUT	= P("LUT")->asTable();

		for(int iClass=0; iClass<12; iClass++)
		{
			CSG_Table_Record	*pClass;

			if( (pClass = pLUT->Get_Record(iClass)) == NULL )
			{
				pClass	= pLUT->Add_Record();
			}

			pClass->Set_Value(0, Classes[iClass].Color);
			pClass->Set_Value(1, Classes[iClass].Name);
			pClass->Set_Value(2, Classes[iClass].Name);
			pClass->Set_Value(3, Classes[iClass].ID);
			pClass->Set_Value(4, Classes[iClass].ID);
		}

		while( pLUT->Get_Record_Count() > 12 )
		{
			pLUT->Del_Record(pLUT->Get_Record_Count() - 1);
		}

		P("COLORS_TYPE")->Set_Value(1);	// Color Classification Type: Lookup Table

		DataObject_Set_Parameters(pTexture, P);
	}

	//-----------------------------------------------------
	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
	{
		for(int x=0; x<Get_NX(); x++)
		{
			int		Texture	= 0;
			double	Sum		= 0.0;

			if(	!(pSand && pSand->is_NoData(x, y))
			&&	!(pSilt && pSilt->is_NoData(x, y))
			&&	!(pClay && pClay->is_NoData(x, y)) )
			{
				double	Sand	= pSand ? pSand->asDouble(x, y) : 100.0 - (pSilt->asDouble(x, y) + pClay->asDouble(x, y));
				double	Silt	= pSilt ? pSilt->asDouble(x, y) : 100.0 - (pSand->asDouble(x, y) + pClay->asDouble(x, y));
				double	Clay	= pClay ? pClay->asDouble(x, y) : 100.0 - (pSand->asDouble(x, y) + pSilt->asDouble(x, y));

				if( (Sum = Sand + Silt + Clay) > 0.0 )
				{
					if( Sum != 100.0 )
					{
						Sand	*= 100.0 / Sum;
						Clay	*= 100.0 / Sum;
					}

					Texture	= Get_Texture(Sand, Clay);
				}
			}

			if( Texture )
			{
				pTexture->Set_Value(x, y, Texture);

				if( pSum )
				{
					pSum->Set_Value(x, y, Sum);
				}
			}
			else
			{
				pTexture->Set_NoData(x, y);

				if( pSum )
				{
					pSum->Set_NoData(x, y);
				}
			}
		}
	}

	//-----------------------------------------------------
	return( true );
}
//---------------------------------------------------------
bool CTable_Text_Import_Numbers::On_Execute(void)
{
    CSG_String	sHead, sLine, Separator;
    CSG_File	Stream;

    //-----------------------------------------------------
    if( !Stream.Open(Parameters("FILENAME")->asString(), SG_FILE_R, false) )
    {
        Error_Set(_TL("file could not be opened"));

        return( false );
    }

    if( Parameters("SKIP")->asInt() > 0 )
    {
        int	i	= Parameters("SKIP")->asInt();

        while( i > 0 && Stream.Read_Line(sLine) )	{
            i--;
        }
    }

    if( !Stream.Read_Line(sHead) || sHead.Length() == 0 )
    {
        Error_Set(_TL("empty or corrupted file"));

        return( false );
    }

    if( !Parameters("HEADLINE")->asBool() )
    {
        sLine	= sHead;
    }
    else if( !Stream.Read_Line(sLine) || sLine.Length() == 0 )
    {
        Error_Set(_TL("empty or corrupted file"));

        return( false );
    }

    //-----------------------------------------------------
    switch( Parameters("SEPARATOR")->asInt() )
    {
    case  0:
        Separator	= "\t";
        break;
    case  1:
        Separator	=  ";";
        break;
    case  2:
        Separator	=  ",";
        break;
    case  3:
        Separator	=  " ";
        break;
    default:
        Separator	= Parameters("SEP_OTHER")->asString();
        break;
    }

    //-----------------------------------------------------
    CSG_Table	*pTable	= Parameters("TABLE")->asTable();

    pTable->Destroy();
    pTable->Set_Name(SG_File_Get_Name(Parameters("FILENAME")->asString(), false));

    sHead.Trim(true);
    sHead.Replace(Separator, "\t");

    while( sHead.Length() > 0 )
    {
        sHead.Trim();

        if( Parameters("HEADLINE")->asBool() )
        {
            pTable->Add_Field(sHead.BeforeFirst('\t'), SG_DATATYPE_Double);
        }
        else
        {
            pTable->Add_Field(CSG_String::Format("FIELD%02d", 1 + pTable->Get_Field_Count()), SG_DATATYPE_Double);
        }

        sHead	= sHead.AfterFirst('\t');
    }

    if( pTable->Get_Field_Count() <= 0 )
    {
        Error_Set(_TL("empty or corrupted file"));

        return( false );
    }

    //-----------------------------------------------------
    int		fLength	= Stream.Length();

    bool	bOkay	= true;

    do
    {
        sLine.Replace(Separator, "\t");

        CSG_Table_Record	*pRecord	= pTable->Add_Record();

        for(int i=0; bOkay && i<pTable->Get_Field_Count(); i++)
        {
            double	Value;

            sLine.Trim();

            if( (bOkay = sLine.asDouble(Value)) == true )
            {
                pRecord->Set_Value(i, Value);

                sLine	= sLine.AfterFirst('\t');
            }
            else
            {
                pTable->Del_Record(pTable->Get_Count() - 1);
            }
        }
    }
    while( bOkay && Stream.Read_Line(sLine) && Set_Progress(Stream.Tell(), fLength) );

    return( pTable->Get_Count() > 0 );
}
Beispiel #6
0
//---------------------------------------------------------
bool CSoil_Texture::On_Execute(void)
{
	int			x,y,intSoilType, MaxX, MaxY;
	float		Sand_Input,Clay_Input;
	CSG_Grid	*pSandInput, *pClayInput, *pOutTexture;


	pSandInput	= Parameters("SAND")->asGrid();
	pClayInput	= Parameters("CLAY")->asGrid();
	pOutTexture	= Parameters("TEXTURE")->asGrid();



	if(pSandInput->Get_NX()==pClayInput->Get_NX() 
		&& pSandInput->Get_NY()==pSandInput->Get_NY() )
	{
		MaxX= pSandInput->Get_NX();
		MaxY= pSandInput->Get_NY();
	}
	else
	{
		MaxX= 0;
		MaxY= 0;

	}

	
	for(y=0;y<MaxY;y++)
	{
		for(x=0;x<MaxX;x++)
		{
			Sand_Input	= pSandInput->asFloat(x, y); 
			Clay_Input	= pClayInput->asFloat(x, y);
			intSoilType	= OutTexture(Sand_Input, Clay_Input);

			if (intSoilType<0 || intSoilType>12)//verify range validity
				pOutTexture->Set_NoData(x, y);
			else
				pOutTexture->Set_Value(x, y, intSoilType);
		
		}
	}


	//-------------------------------------------------
	if( 1 )
	{
		CSG_Parameters	Parms;

		if( DataObject_Get_Parameters(pOutTexture, Parms) && Parms("COLORS_TYPE") && Parms("LUT") )
		{
			CSG_Table	*pLUT	= Parms("LUT")->asTable();

			for(int iClass=0; iClass<12; iClass++)
			{
				CSG_Table_Record	*pClass;

				if( (pClass = pLUT->Get_Record(iClass)) == NULL )
				{
					pClass	= pLUT->Add_Record();
				}

				pClass->Set_Value(0, TEXTURE_COLOR[iClass]);
				pClass->Set_Value(1, TEXTURE_NAMES[iClass]);
				pClass->Set_Value(2, TEXTURE_NAMES[iClass]);
				pClass->Set_Value(3, iClass + 1);
				pClass->Set_Value(4, iClass + 1);
			}

			while( pLUT->Get_Record_Count() > 12 )
			{
				pLUT->Del_Record(pLUT->Get_Record_Count() - 1);
			}

			Parms("COLORS_TYPE")->Set_Value(1);	// Color Classification Type: Lookup Table

			DataObject_Set_Parameters(pOutTexture, Parms);
		}
	}


	//-------------------------------------------------
	Message_Add(_TL("Hello by G. Massei"));
	
	return( true );
}
Beispiel #7
0
//---------------------------------------------------------
bool CSoil_Texture_Table::On_Execute(void)
{
	//-----------------------------------------------------
	CSG_Table	*pTable		= Parameters("TABLE")->asTable();

	int		iSand		= Parameters("SAND"   )->asInt();
	int		iSilt		= Parameters("SILT"   )->asInt();
	int		iClay		= Parameters("CLAY"   )->asInt();
	int		iTexture	= Parameters("TEXTURE")->asInt();

	//-----------------------------------------------------
	if( (iSand >= 0 ? 1 : 0) + (iSilt >= 0 ? 1 : 0) + (iClay >= 0 ? 1 : 0) < 2 )
	{
		Error_Set(_TL("at least two contents (sand, silt, clay) have to be given"));

		return( false );
	}

	//-----------------------------------------------------
	if( iTexture < 0 )
	{
		iTexture	= pTable->Get_Field_Count();

		pTable->Add_Field("TEXTURE", SG_DATATYPE_String);
	}

	//-----------------------------------------------------
	for(int i=0; i<pTable->Get_Count() && Set_Progress(i, pTable->Get_Count()); i++)
	{
		CSG_Table_Record	*pRecord	= pTable->Get_Record(i);

		if(	(iSand >= 0 && pRecord->is_NoData(iSand))
		||	(iSilt >= 0 && pRecord->is_NoData(iSilt))
		||	(iClay >= 0 && pRecord->is_NoData(iClay)) )
		{
			pRecord->Set_NoData(iTexture);
		}
		else
		{
			int		Class	= -1;

			if( iSand >= 0 && iSilt >= 0 && iClay >= 0 )
			{
				double	Sum;

				Class	= Get_Texture(pRecord->asDouble(iSand), pRecord->asDouble(iSilt), pRecord->asDouble(iClay), Sum);
			}
			else if( iSilt < 0 )
			{
				Class	= Get_Texture_SandClay(pRecord->asDouble(iSand), pRecord->asDouble(iClay));
			}
			else if( iClay < 0 )
			{
				Class	= Get_Texture_SandSilt(pRecord->asDouble(iSand), pRecord->asDouble(iSilt));
			}
			else if( iSand < 0 )
			{
				Class	= Get_Texture_SiltClay(pRecord->asDouble(iSilt), pRecord->asDouble(iClay));
			}

			pRecord->Set_Value (iTexture, Classes[Class].Key);
		}
	}

	DataObject_Update(pTable);

	//-----------------------------------------------------
	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pTable, "LUT");

	if( pLUT && pLUT->asTable() )
	{
		CSG_Table	*pClasses	= pLUT->asTable();

		for(int iClass=0; iClass<12; iClass++)
		{
			CSG_Table_Record	*pClass	= pClasses->Get_Record(iClass);

			if( pClass == NULL )
			{
				pClass	= pClasses->Add_Record();
			}

			pClass->Set_Value(0, Classes[iClass].Color);
			pClass->Set_Value(1, Classes[iClass].Name);
			pClass->Set_Value(2, Classes[iClass].Name);
			pClass->Set_Value(3, Classes[iClass].Key);
			pClass->Set_Value(4, Classes[iClass].Key);
		}

		while( pClasses->Get_Count() > 12 )
		{
			pClasses->Del_Record(pClasses->Get_Count() - 1);
		}

		DataObject_Set_Parameter(pTable, pLUT);	// Lookup Table
		DataObject_Set_Parameter(pTable, "LUT_ATTRIB" , iTexture);	// Lookup Table Attribute
		DataObject_Set_Parameter(pTable, "COLORS_TYPE", 1       );	// Color Classification Type: Lookup Table
	}

	//-----------------------------------------------------
	return( true );
}
Beispiel #8
0
//---------------------------------------------------------
bool CSoil_Texture::On_Execute(void)
{
	//-----------------------------------------------------
	CSG_Grid	*pSand	= Parameters("SAND"   )->asGrid();
	CSG_Grid	*pSilt	= Parameters("SILT"   )->asGrid();
	CSG_Grid	*pClay	= Parameters("CLAY"   )->asGrid();
	CSG_Grid	*pClass	= Parameters("TEXTURE")->asGrid();
	CSG_Grid	*pSum	= Parameters("SUM"    )->asGrid();

	//-----------------------------------------------------
	if( (pSand ? 1 : 0) + (pSilt ? 1 : 0) + (pClay ? 1 : 0) < 2 )
	{
		Error_Set(_TL("at least two contents (sand, silt, clay) have to be given"));

		return( false );
	}

	//-----------------------------------------------------
	pClass->Set_NoData_Value(-1.0);

	CSG_Parameter	*pLUT	= DataObject_Get_Parameter(pClass, "LUT");

	if( pLUT && pLUT->asTable() )
	{
		CSG_Table	*pClasses	= pLUT->asTable();

		for(int iClass=0; iClass<12; iClass++)
		{
			CSG_Table_Record	*pClass	= pClasses->Get_Record(iClass);

			if( pClass == NULL )
			{
				pClass	= pClasses->Add_Record();
			}

			pClass->Set_Value(0, Classes[iClass].Color);
			pClass->Set_Value(1, Classes[iClass].Name);
			pClass->Set_Value(2, Classes[iClass].Key);
			pClass->Set_Value(3, iClass);
			pClass->Set_Value(4, iClass);
		}

		while( pClasses->Get_Count() > 12 )
		{
			pClasses->Del_Record(pClasses->Get_Count() - 1);
		}

		DataObject_Set_Parameter(pClass, pLUT);	// Lookup Table
		DataObject_Set_Parameter(pClass, "COLORS_TYPE", 1);	// Color Classification Type: Lookup Table
	}

	//-----------------------------------------------------
	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
	{
		#pragma omp parallel for
		for(int x=0; x<Get_NX(); x++)
		{
			if(	(pSand && pSand->is_NoData(x, y))
			||	(pSilt && pSilt->is_NoData(x, y))
			||	(pClay && pClay->is_NoData(x, y)) )
			{
				SG_GRID_PTR_SAFE_SET_NODATA(pClass, x, y);
				SG_GRID_PTR_SAFE_SET_NODATA(pSum  , x, y);
			}
			else
			{
				int		Class	= -1;
				double	Sum		= 100.0;

				if( pSand && pSilt && pClay )
				{
					Class	= Get_Texture(pSand->asDouble(x, y), pSilt->asDouble(x, y), pClay->asDouble(x, y), Sum);
				}
				else if( !pSilt )
				{
					Class	= Get_Texture_SandClay(pSand->asDouble(x, y), pClay->asDouble(x, y));
				}
				else if( !pClay )
				{
					Class	= Get_Texture_SandSilt(pSand->asDouble(x, y), pSilt->asDouble(x, y));
				}
				else if( !pSand )
				{
					Class	= Get_Texture_SiltClay(pSilt->asDouble(x, y), pClay->asDouble(x, y));
				}

				SG_GRID_PTR_SAFE_SET_VALUE(pClass, x, y, Class);
				SG_GRID_PTR_SAFE_SET_VALUE(pSum  , x, y, Sum  );
			}
		}
	}

	//-----------------------------------------------------
	return( true );
}