#include "menu_db.h"

#include <fstream>

bool Cmenu_db::create_shape_fromSF(CSG_Shapes *pShapes)
{
	// get SHAPE_TYPE
	switch (SimpleFeature->GetGeoType())
	{
		default: 
			return(false);
		case 1: pShapes->Create(SHAPE_TYPE_Point, SimpleFeature->GetFeatureName().c_str());
			break;
		case 2: pShapes->Create(SHAPE_TYPE_Line, SimpleFeature->GetFeatureName().c_str());
			break;
		case 3: pShapes->Create(SHAPE_TYPE_Polygon, SimpleFeature->GetFeatureName().c_str());
			break;
		case 4: pShapes->Create(SHAPE_TYPE_Points, SimpleFeature->GetFeatureName().c_str());
			break;
		case 5: pShapes->Create(SHAPE_TYPE_Line, SimpleFeature->GetFeatureName().c_str());
			break;
		case 6: pShapes->Create(SHAPE_TYPE_Polygon, SimpleFeature->GetFeatureName().c_str());
			break;
		//case 7: // SF_GeometryCollection not yet implemented
	} // end switch

	// Assign coordinates
	for (unsigned int i = 0; i < SimpleFeature->GetNumFeatures(); i++)
	{
		pShapes->Add_Shape();
		for (unsigned int z = 0; z < SimpleFeature->GetNumPointsFeature(i); z++)
			pShapes->Get_Shape(i)->Add_Point(SimpleFeature->Get_X_Value(i,z),
											 SimpleFeature->Get_Y_Value(i,z),i);
	}

	return(true);
}