// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'sgTools.pas' rev: 6.00

#ifndef sgToolsHPP
#define sgToolsHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <sgSelection.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <ExtCtrls.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <HPGL2.hpp>	// Pascal unit
#include <Extrusion.hpp>	// Pascal unit
#include <sgConsts.hpp>	// Pascal unit
#include <DXFConv.hpp>	// Pascal unit
#include <DXFImage.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Sgtools
{
//-- type declarations -------------------------------------------------------
struct TSnapPointData
{
	Types::TPoint Point;
	Sgconsts::TFPoint FPoint;
	Dxfconv::TsgDXFEntity* Entity;
	Sgconsts::TObjectSnapMode SnapMode;
} ;

class DELPHICLASS TsgObjectSnap;
class PASCALIMPLEMENTATION TsgObjectSnap : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	int FSnapDistance;
	Dxfimage::TsgDXFImage* FCADImage;
	Dxfimage::PSnapData __fastcall FindSnap(const Types::TPoint &APoint);
	void __fastcall SetSnapDistance(const int AVal);
	
public:
	__fastcall TsgObjectSnap(void);
	Sgconsts::TFPoint __fastcall GetSnapPoint(const Types::TPoint &AVisiblePoint, Sgconsts::TObjectSnapMode &AObjectSnapMode, Dxfconv::TsgDXFEntity* &AEntity)/* overload */;
	Sgconsts::TFPoint __fastcall GetSnapPoint(const Types::TPoint &AVisiblePoint, Sgconsts::TObjectSnapMode &AObjectSnapMode, Dxfconv::TsgDXFEntity* &AEntity, Sgconsts::TFPoint &CoordsInUCS)/* overload */;
	void __fastcall SetsgDXFImage(Dxfimage::TsgDXFImage* ACADImage);
	__property int SnapDistance = {read=FSnapDistance, write=SetSnapDistance, nodefault};
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TsgObjectSnap(void) { }
	#pragma option pop
	
};


class DELPHICLASS TSnapMarker;
class PASCALIMPLEMENTATION TSnapMarker : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	int FDrawAreaSize;
	Dxfimage::TsgDXFImage* FDXFImage;
	double FImageScale;
	#pragma pack(push, 1)
	Types::TPoint FPoint;
	#pragma pack(pop)
	
	Sgconsts::TFPoint FRealPoint;
	bool FRepaint;
	Controls::TControl* FImage;
	Sgconsts::TObjectSnapMode FSnap;
	bool FSnapped;
	void __fastcall ClearPoint(void);
	void __fastcall Draw(bool Erase);
	void __fastcall Erase(void);
	void __fastcall Repaint(System::TObject* Sender);
	void __fastcall SetDXFImage(Dxfimage::TsgDXFImage* ADXFImage);
	void __fastcall SetImage(Controls::TControl* AImage);
	double __fastcall GetScale(void);
	Graphics::TCanvas* __fastcall GetCanvas(void);
	
public:
	__fastcall TSnapMarker(Controls::TControl* AImage);
	__fastcall virtual ~TSnapMarker(void);
	void __fastcall ClearSnap(void);
	void __fastcall Snap(const Sgconsts::TFPoint &APoint, Sgconsts::TObjectSnapMode ASnap);
	__property Controls::TControl* Image = {read=FImage, write=SetImage};
	__property double Scale = {read=GetScale};
	__property Graphics::TCanvas* Canvas = {read=GetCanvas};
};


class DELPHICLASS TSnapControl;
class PASCALIMPLEMENTATION TSnapControl : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	Dxfimage::TsgDXFImage* FImg;
	TsgObjectSnap* FObjectSnap;
	Controls::TControl* FImage;
	TSnapMarker* FSnapMarker;
	Dxfconv::TsgDXFEntity* FSnappedEntity;
	Sgconsts::TObjectSnapMode FSnapMode;
	void __fastcall CreateSnapMarker(void);
	Controls::TControl* __fastcall GetFImage(void);
	void __fastcall ResetEvents(void);
	void __fastcall SetFImage(Controls::TControl* AValue);
	void __fastcall SetSnapMode(Sgconsts::TObjectSnapMode Value);
	void __fastcall SetEvents(void);
	
protected:
	void __fastcall Repaint(System::TObject* Sender);
	
public:
	__fastcall TSnapControl(void);
	__fastcall virtual ~TSnapControl(void);
	virtual void __fastcall Dispatch(void *Message);
	Sgconsts::TFPoint __fastcall GetMouseCoord(int X, int Y);
	Sgconsts::TFPoint __fastcall GetMouseCoordUCS(int X, int Y, Sgconsts::TFPoint &PointInUCS);
	__property Controls::TControl* Image = {read=GetFImage, write=SetFImage};
	__property Sgconsts::TObjectSnapMode SnapMode = {read=FSnapMode, write=SetSnapMode, nodefault};
	__property Dxfconv::TsgDXFEntity* SnappedEntity = {read=FSnappedEntity};
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE AnsiString sUnits;
extern PACKAGE AnsiString sInch;
extern PACKAGE AnsiString sMM;
extern PACKAGE double __fastcall GetAreaHPGL(Classes::TList* AList, Hpgl2::TsgHPGLImage* AHPGLImage);
extern PACKAGE double __fastcall GetArea(Classes::TList* AList);
extern PACKAGE Dxfimage::TsgDistanceUnits __fastcall GetDistanceUnits(Dxfimage::TsgDXFImage* ADXFImage, Dxfconv::TsgDXFLayout* ALayout, AnsiString &UnitsUserName, double &UnitsUserFactor, AnsiString &AltUnitsUserName, double &AltUnitsUserFactor);
extern PACKAGE Sgconsts::TFPoint __fastcall GetRealPointUsingsgImagePoint(Extctrls::TImage* AImage, int X, int Y, Sgconsts::TFPoint &PtInUCS);

}	/* namespace Sgtools */
using namespace Sgtools;
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// sgTools
