// studs3d.h : main header file for the STUDS3D DLL
//

#if !defined(AFX_STUDS3D_H__24B68F05_DA80_11D4_BF5E_0050BADBD5F5__INCLUDED_)
#define AFX_STUDS3D_H__24B68F05_DA80_11D4_BF5E_0050BADBD5F5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols
#include <ldefin2d.h>
#include <ldefin3d.h>

#ifdef __LIGHT_VERSION__
#include <klAPI5.h>
#else
#include <kAPI5.h>
#endif

/////////////////////////////////////////////////////////////////////////////
// CStuds3dApp
// See studs3d.cpp for the implementation of this class
//

class CStuds3dApp : public CWinApp
{
public:
	CStuds3dApp();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CStuds3dApp)
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CStuds3dApp)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


#define AXIS_OFF     0x1    // 0  >0  
#define PITCH        0x2    //   >0  
#define ALLST        0x4    //   b >0   
#define KONTR        0x8    //    >0    
#define SIMPLE       0x10   //   >0  
#define SECOFF       0x10   // 0   1> ,  ,  
#define TAKEKONTR    0x20   //    >0  
#define REVERCE_ON   0x20   //  \  >0;
#define TAKEPODG     0x40   //    >0  
#define LEFT_DRAW    0x40   //   >0;
#define ISPOLN       0x80   //  1 >0  2
#define TAKEISPOLN   0x100  // 0     >0  
#define FLAGLENGTH   0x200  //      >0  
#define ISPOLN3      0x200  //   0 - 2 > 0  3
#define REVERCE_DRAW 0x200  //    >0 ;  0-  
#define SBORSHAYBA   0x400  //     >0    
#define PITCHOFF     0x800  //      >0   
#define LENLEN       0x1000 // 0    1 
#define LENLENOFF    0x2000 // 0   1 
#define ALLST_OF     0x4000 // > 0  checkbox    
//#define DRAW_ST_OF   0x8000 // 0     > 0 -   


// 
#define KEY_S_ON     0x1 // 0-      > 0 - 
#define KEY_S        0x2 // 0-   ; > 0 
#define KOEFF_MAT_ON 0x4 // 0-  , >0  
#define KEY_S_GRAY   0x8 // > 0  checkbox "   "
#define DRAW_ST_OF   0x10 // 0     > 0 -   

#define  COUNT_MASSA 1000

////////////////////////////////////////////////////////////////////////////////
//
//      
//
////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------
//
// ---
struct BaseMakroParam {
  float          ang;
  unsigned short flagAttr;
  short          drawType;
  BYTE           typeSwitch;  //       0 Placement 1 Curso
                              //   0 -  +   0X ( Placement );
                              //   1 - ,     0X   ( Cursor ).
};

//------------------------------------------------------------------------------
//  
// ---
struct SHPEEL {
  float d;          //  
  float p1;         //  
  float p2;         //  
  float b1;         //    l1
  float c;          //  
  float l;          //  
  float b;          //    l0
  short f;          //  
  short klass;      //  
  short gost;       //  
  short ver;        //  
  float m1;         //  1 
  float m2;         //  2 
  short indexMassa; // 0- 1-   3- 2-
};

//------------------------------------------------------------------------------
//
// ---
struct ShpeelBase {
  reference bg, rg1, rg2;
  reference bs, rs1, rs2;
};

//------------------------------------------------------------------------------
//  
// ---
class Shpeel {
private :
	bool										openBase;
	ksDocument3D 						doc;            //   3D-
	ksSpecification         specification;  //  
  ksPart                  part;           // 
  ksEntityCollection      collect;        //   entity 
  bool                    collectChanged; // true -  
  CString									fileName;
  UINT										countObj;
  int											flagMode;

	ksUserParam				paramSTmp; //    
	ksUserParam				paramTmp;  //    
	ksUserParam				param;     //   Get/SetMacroParam
	ksDataBaseObject	data;      //  

  BaseMakroParam par;
  SHPEEL				 tmp;
  ShpeelBase		 base;      //   

public :
  Shpeel();
  Shpeel( const Shpeel& other );                //  

  operator void* () { return &par.ang; }  //      void*

static bool DrawSpcObj();

  void 						Init();
  void						Assign( const Shpeel& other );    //  
  Shpeel*					Dublicate();                      //  

  ksDataBaseObject&	GetDataBase()  { return data;      }
  ksUserParam&      GetParamTmp()  { return paramTmp;  }
  ksUserParam&      GetParamSTmp() { return paramSTmp; }

  ShpeelBase&			GetShpeelBase() { return base; } //   
  SHPEEL&					GetShpeelParam(){ return tmp; }   //  
  BaseMakroParam& GetBaseParam() { return par; }
  bool&           GetCollectChanged() { return collectChanged; }
  ksPart&         GetPart() { return part; } // AddRef -  
  short&					GetDrawType() { return par.drawType; }
  unsigned short& GetFlagAttr() { return par.flagAttr; }
  void						SetAttr() {par.flagAttr = par.flagAttr ? false : true; }
	bool            IsBaseOpen() { return openBase; }

  UINT      GetObjCount() { return countObj; }
  int       Size() { return sizeof(BaseMakroParam) + sizeof(SHPEEL); }
  bool      ReadElemBase( double d/* */ ) { return false; } //  
  bool      OpenElemBase() { return OpenBase(); }  //    
  void      CloseElemBase() { CloseBase(); }       //  
  bool      GetDirectionElem() { return true; } //
            //  
  void      SetMates( ksDocument3D& doc, ksRequestInfo3D& info, bool delMates = false );
            //       
  void      SetCallBackAndFilterFunction( ksRequestInfo3D& info );
  int       GetParam();
	//       
	// planar = true - , false -  
	void      GetEntityByName( const char* name, ksEntity& entity );
	bool      IsCollectionEmpty( ksRequestInfo3D& info ); //   -  placement
	bool      IsCollectionChange( ksRequestInfo3D& info );
  void      _MessageBoxResult();
	void      InitUserParamTmp();
	void      GetUserParamTmp();
	void      InitUserParamSTmp();
	void      GetUserParamSTmp();
	void      InitUserParam();
	void      SetUserParam();
	void      GetUserParam();
  void      Draw3D( ksDocument3D& doc ); //  3D 
	int       _ConnectDB( reference bd, char *name );
  bool      OpenBase( bool initParam = true );  //  
  void      CloseBase();                        //  
	int				ReadShpeelBase( float d );
	int				ReadShpeelStBase();
	int       ChoiceMenuId();
  void      SetParam( ksPart& _part );
  CString&  SetFileName();

  reference EditSpcObj( reference * );
	int       MacroElementParam();
};




/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STUDS3D_H__24B68F05_DA80_11D4_BF5E_0050BADBD5F5__INCLUDED_)
