//////////////////////////////////////////////////////////////////////////////
//
//  Copyright 2023 Autodesk, Inc.  All rights reserved.
//
//  Use of this software is subject to the terms of the Autodesk license 
//  agreement provided at the time of installation or download, or which 
//  otherwise accompanies this software in either electronic or hard copy form.   
//
//////////////////////////////////////////////////////////////////////////////

// DESCRIPTION: This file contains class and functions definitions for
//              MCADAPI geometry keys.
//
#ifndef AMIGEOM_H
#define AMIGEOM_H

#include "mibase.h"
#include "AdAChar.h"

class AcGeEntity3d;
class AcGeSurface;
class AcGeCurveBoundary;
class AmiFeatKey;
class AmiConstrKey;
class AmiSketchKey;
class AmiPartKey;

#define AMI_FROMTHEBEGINNING -1
#define AMI_TOTHEEND -1

///<summary>This is class AmiGeomKey.</summary>
class AMIAPI AmiGeomKey : public AmiObjectKey
{
  public:

    MCADAPI_DECLARE_MEMBERS(AmiGeomKey);

  protected:
    AmiGeomKey() {}
};

///<summary>This is class AmiPointKey.</summary>
class AMIAPI AmiPointKey : public AmiGeomKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiPointKey);
};

///<summary>This is class AmiVectorKey.</summary>
class AMIAPI AmiVectorKey : public AmiGeomKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiVectorKey);
};

///<summary>This is class AmiCurveKey.</summary>
class AMIAPI AmiCurveKey : public AmiGeomKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiCurveKey);
};

///<summary>This is class AmiLineKey.</summary>
class AMIAPI AmiLineKey : public AmiCurveKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiLineKey);
};

///<summary>This is class AmiArcKey.</summary>
class AMIAPI AmiArcKey : public AmiCurveKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiArcKey);
};

///<summary>This is class AmiEllipseKey.</summary>
class AMIAPI AmiEllipseKey : public AmiCurveKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiEllipseKey);
};

///<summary>This is class AmiSplineCrvKey.</summary>
class AMIAPI AmiSplineCrvKey : public AmiCurveKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiSplineCrvKey);
};

///<summary>This is class AmiPolylineKey.</summary>
class AMIAPI AmiPolylineKey : public AmiCurveKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiPolylineKey);
};

///<summary>This is class AmiAuglineKey.</summary>
class AMIAPI AmiAuglineKey : public AmiCurveKey
{
  public:
    MCADAPI_DECLARE_MEMBERS(AmiAuglineKey);
};

typedef AmiArray<AmiGeomKey>   AmiGeomKeyArray;
typedef AmiArray<AmiPointKey>  AmiPointKeyArray;
typedef AmiArray<AmiLineKey>   AmiLineKeyArray;


///<summary>Creates a geometric key of a specified type using information
///              passed in by pick objects.  The function can infer geometry
///              from other geometry. A point can be inferred as the endpoint
///              of an open curve, the midpoint of a picked line or the center
///              point of an arc or ellipse. A line can be inferred as the axis
///              through the center of a picked arc perpendicular to the plane
///              of the arc. A plane can be inferred as the plane of a picked
///              arc or by two coplanar lines that were picked. If the operation
///              cannot be completed a bad status is returned and pGeomKey is
///              set to NULL.  It is the caller�s responsibility to release the
///              key.</summary>
///<param name="type">The type of the geometry to be created.</param>
///<param name="inferFlag">A flag set to true or false to allow or disallow
///                          geometry to be inferred from other picked geometry.
///                          if false, do not infer any geometry.</param>
///<param name="pickObj1">Pick information.</param>
///<param name="pickObj2">Additional pick information required to infer the
///                          final key when two picked entities are involved as
///                          in inferring a plane from two coplanar lines.</param>
///<param name="pGeomKey">The pointer to the new geometry key.</param>
AMIAPI AmiStatus amiGetGeomKey( AmiKeyType type,
							    Adesk::Boolean inferFlag, AmiGeomKey*& pGeomKey,
							    AmiPickObj* pPickObj1, AmiPickObj* pPickObj2 = NULL );

///<summary>Returns an AcGe entity copy of the geometric object referred
///              to by the specified key. The GeLib object that is returned
///              is a snapshot of the geometric object referred to by the key
///              at the time of the query. After its construction, the GeLib
///              object is not kept up-to-date by the MCAD API. After being
///              used, the GeLib object should be deleted.</summary>
///<param name="pGeomKey">Pointer to geometry key that refers to the object
///                          for which an AcGe entity copy is needed.</param>
///<param name="pGeEntity">A pointer to the new GeEntity.</param>
AMIAPI AmiStatus amiGetGeomData ( AmiGeomKey* pGeomKey, AcGeEntity3d*& pGeEntity );

///<summary>Sets the data in the geometric object referred to by the
///              specified key to the data in the Ge entity passed in. This
///              call will be successful only if the geometry is directly
///              editable as defined by the result of a call to
///              amiIsDirectlyEditable.</summary>
///<param name="pGeomKey">Pointer to geometry key to entity to be set.</param>
///<param name="pGeEntity">Pointer to Ge entity to be used in setting the
///                          geometric object.</param>
AMIAPI AmiStatus amiSetGeometry ( AmiGeomKey* pGeomKey, AcGeEntity3d* pGeEntity );

///<summary>Checks if the geometric object referenced by pGeomKey has
///              changed since last checked. By default, notification is reset
///              after the call, meaning that if a change is indicated in a
///              call, a second call indicates change only if another change
///              happened since the previous call. This resetting can be
///              avoided by passing the value of resetNotification as
///              Adesk::kFalse.</summary>
///<param name="pGeomKey">A pointer to geometry key to application geometry.</param>
///<param name="resetToNewState">If true, passive notification will be
///                         reset; if false, passive notification will not be
///                         reset.</param>
///<param name="changed">A value of true if the application object changed;
///                         otherwise, it is false.</param>
AMIAPI AmiStatus amiObjectHasChanged ( AmiGeomKey* pGeomKey, Adesk::Boolean& changed,
                              Adesk::Boolean resetToNewState = Adesk::kTrue );

#endif  // AMIGEOM_H
