#ifndef IconShape_First

#ifdef __GNUG__
#pragma interface
#endif

#define IconShape_First

// @(#)IconShape.h	3.9	7/28/92

#include "Shape.h"

class QueryShape: public Object {  // Shape is too costly ?
protected:
  long			oid;
  bool			is_trans;
  short			ink;
  char			**attr;
  short			n_attr;
  short			label_h;
  short			label_w;
  Rectangle		bbox;
  class MapView		*dv;
  short			font_h;
  Point			labelpos;

  void			SetBBox(Rectangle r);

public:
  MetaDef(QueryShape);

  QueryShape(MapView *);
  ~QueryShape();

  virtual void Draw();
  void DrawLabel();
  virtual bool ContainsPoint1(Point) { return FALSE; }
  virtual int Distance(Point p) { return -1; } // returns distance from p
  void SetOid(long o) { oid= o; }
  virtual long GetOid() const { return oid; }
  unsigned long Hash () { return oid; };
  bool IsEqual(Object* op) { return oid == ((QueryShape*)op)->oid; }
  void SetAttr(char **, bool trans);
  void SetColor(int i) { ink= i; }
  int GetColor() const { return ink; }
  Rectangle GetBBox() const { return bbox; }
  virtual void CompBBox() {};

  void DrawCol(int c) {
    int oldcol= GetColor();
    SetColor(c);
    Draw();
    SetColor(oldcol);
  }
};

void DrawAllLabels();


class PlineShape : public QueryShape {
protected:
    short	npoints;
    short	width;
    bool	closed;
    Point	*pts;
    float	start_long,
		end_long,
		start_lat,
		end_lat;
public:
    MetaDef(PlineShape);

    PlineShape(class MapView *, char *s);
    ~PlineShape();
    void Draw();
    bool ContainsPoint1(Point);
    int Distance(Point);
    void CompBBox();
    void SetWidth(int w) { width= w; }

    int	NrPoints() { return npoints; }
    Point GetPoint(int i) { return pts[i]; }
    float GetStart(float *lng, float *lat)
	{ *lng= start_long, *lat= start_lat; }
    float GetEnd(float *lng, float *lat)
	{ *lng= end_long, *lat= end_lat; }
};

class IconShape : public QueryShape {
protected:
    class Bitmap	*bm;
    Rectangle		pickrec;
    Point		origin;
    Point		center;
public:
    MetaDef(IconShape);

    IconShape(MapView *, Bitmap *b);
    SetBitmap(Bitmap *b)	{ bm= b; }
    void Init(float lng, float lat);
    void Draw();
    bool ContainsPoint1(Point);
    int Distance(Point);
    void CompBBox();
};

class Bitmap *NewIconBM(Point, short *);

#endif IconShape_First
