Click here to Skip to main content
15,885,032 members
Articles / Desktop Programming / MFC

SolidGraph CAD System

Rate me:
Please Sign up or sign in to vote.
4.97/5 (78 votes)
12 Sep 20062 min read 375.2K   29.8K   209  
A SolidGraph CAD system source code.
#ifndef __FaceCommand__
#define __FaceCommand__

#include <list>
#include <vector>


typedef enum
{
	HO_UNKNOWN_ERROR,
	HO_OUT_NOT_FLAT,
	HO_OUT_BAD_ORIENT,
	HO_IN_NO_CLOSE,
	HO_IN_NO_FLAT,
	HO_NOT_IN_ONE_PLANE,
	HO_INTERSECTS_WITH_OUT,
	HO_IN_NOT_INSIDE_OUT,
	HO_INTERSECTS_WITH_OTHER_HOLE,
	HO_INSIDE_EXIST_HOLE,
	HO_CONTAIN_EXIST_HOLE,
	HO_SUCCESS
} HO_CORRECT_PATHS_RES;


class FaceCommand : public ICommander, public IContextMenuInterface
{
	IApplicationInterface* m_app;
private:
	IGetObjectsPanel*      m_get_main_object_panel;
	IGetObjectsPanel*      m_get_sub_objects_panel;
	
	sgCObject*             m_first_obj;
	std::vector<sgCObject*>  m_otv;
	int                    m_step;
	CString m_message;

	SG_VECTOR              m_plane_Normal;
	double                 m_plane_D;

	std::list<SG_LINE>     m_object_lines;
	void                   FillObjectLinesList(sgCObject*);
	bool                   IsIntersect(SG_LINE*);

	HO_CORRECT_PATHS_RES   GoodObjectForHole(const sgC2DObject* try_hole);
public:
	FaceCommand(IApplicationInterface* appI);
	virtual ~FaceCommand();

	virtual void            Start()	;
	virtual bool            PreTranslateMessage(MSG* pMsg);
	virtual void            Draw();
	IContextMenuInterface*    GetContextMenuInterface() {return this;};

	virtual void            SendCommanderMessage(COMMANDER_MESSAGE, void*);

private:	
	virtual unsigned int    GetItemsCount();
	virtual void            GetItem(unsigned int, CString&);
	virtual void            GetItemState(unsigned int, bool&, bool&);
	virtual HBITMAP  GetItemBitmap(unsigned int);
	virtual void            Run(unsigned int);

	void            MouseMove(unsigned int,int,int);
	void            LeftClick(unsigned int,int,int);
	void            OnEnter();
};

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions