Blame libdjvu/GMapAreas.h

Packit df99a1
//C-  -*- C++ -*-
Packit df99a1
//C- -------------------------------------------------------------------
Packit df99a1
//C- DjVuLibre-3.5
Packit df99a1
//C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
Packit df99a1
//C- Copyright (c) 2001  AT&T
Packit df99a1
//C-
Packit df99a1
//C- This software is subject to, and may be distributed under, the
Packit df99a1
//C- GNU General Public License, either Version 2 of the license,
Packit df99a1
//C- or (at your option) any later version. The license should have
Packit df99a1
//C- accompanied the software or you may obtain a copy of the license
Packit df99a1
//C- from the Free Software Foundation at http://www.fsf.org .
Packit df99a1
//C-
Packit df99a1
//C- This program is distributed in the hope that it will be useful,
Packit df99a1
//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit df99a1
//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit df99a1
//C- GNU General Public License for more details.
Packit df99a1
//C- 
Packit df99a1
//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library from
Packit df99a1
//C- Lizardtech Software.  Lizardtech Software has authorized us to
Packit df99a1
//C- replace the original DjVu(r) Reference Library notice by the following
Packit df99a1
//C- text (see doc/lizard2002.djvu and doc/lizardtech2007.djvu):
Packit df99a1
//C-
Packit df99a1
//C-  ------------------------------------------------------------------
Packit df99a1
//C- | DjVu (r) Reference Library (v. 3.5)
Packit df99a1
//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
Packit df99a1
//C- | The DjVu Reference Library is protected by U.S. Pat. No.
Packit df99a1
//C- | 6,058,214 and patents pending.
Packit df99a1
//C- |
Packit df99a1
//C- | This software is subject to, and may be distributed under, the
Packit df99a1
//C- | GNU General Public License, either Version 2 of the license,
Packit df99a1
//C- | or (at your option) any later version. The license should have
Packit df99a1
//C- | accompanied the software or you may obtain a copy of the license
Packit df99a1
//C- | from the Free Software Foundation at http://www.fsf.org .
Packit df99a1
//C- |
Packit df99a1
//C- | The computer code originally released by LizardTech under this
Packit df99a1
//C- | license and unmodified by other parties is deemed "the LIZARDTECH
Packit df99a1
//C- | ORIGINAL CODE."  Subject to any third party intellectual property
Packit df99a1
//C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
Packit df99a1
//C- | non-exclusive license to make, use, sell, or otherwise dispose of 
Packit df99a1
//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
Packit df99a1
//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
Packit df99a1
//C- | General Public License.   This grant only confers the right to 
Packit df99a1
//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
Packit df99a1
//C- | the extent such infringement is reasonably necessary to enable 
Packit df99a1
//C- | recipient to make, have made, practice, sell, or otherwise dispose 
Packit df99a1
//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
Packit df99a1
//C- | any greater extent that may be necessary to utilize further 
Packit df99a1
//C- | modifications or combinations.
Packit df99a1
//C- |
Packit df99a1
//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
Packit df99a1
//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
Packit df99a1
//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
Packit df99a1
//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Packit df99a1
//C- +------------------------------------------------------------------
Packit df99a1
Packit df99a1
#ifndef _GMAPAREAS_H
Packit df99a1
#define _GMAPAREAS_H
Packit df99a1
#ifdef HAVE_CONFIG_H
Packit df99a1
#include "config.h"
Packit df99a1
#endif
Packit df99a1
#if NEED_GNUG_PRAGMAS
Packit df99a1
# pragma interface
Packit df99a1
#endif
Packit df99a1
Packit df99a1
Packit df99a1
#include "GSmartPointer.h"
Packit df99a1
#include "GContainer.h"
Packit df99a1
#include "GString.h"
Packit df99a1
#include "GRect.h"
Packit df99a1
#include "GURL.h"
Packit df99a1
Packit df99a1
#ifdef HAVE_NAMESPACES
Packit df99a1
namespace DJVU {
Packit df99a1
# ifdef NOT_DEFINED // Just to fool emacs c++ mode
Packit df99a1
}
Packit df99a1
#endif
Packit df99a1
#endif
Packit df99a1
Packit df99a1
Packit df99a1
/** @name GMapAreas.h
Packit df99a1
Packit df99a1
    Files #"GMapAreas.h"# and #"GMapAreas.cpp"# implement base objects
Packit df99a1
    used by the plugin to display and manage hyperlinks and highlighted
Packit df99a1
    areas inside a \Ref{DjVuImage} page.
Packit df99a1
Packit df99a1
    The currently supported areas can be rectangular (\Ref{GMapRect}),
Packit df99a1
    elliptical (\Ref{GMapOval}) and polygonal (\Ref{GMapPoly}). Every
Packit df99a1
    map area besides the definition of its shape contains information
Packit df99a1
    about display style and optional {\bf URL}, which it may refer to.
Packit df99a1
    If this {\bf URL} is not empty then the map area will work like a
Packit df99a1
    hyperlink.
Packit df99a1
Packit df99a1
    The classes also implement some useful functions to ease geometry
Packit df99a1
    manipulations
Packit df99a1
Packit df99a1
    @memo Definition of base map area classes
Packit df99a1
    @author Andrei Erofeev <eaf@geocities.com>
Packit df99a1
*/
Packit df99a1
//@{
Packit df99a1
Packit df99a1
Packit df99a1
// ---------- GMAPAREA ---------
Packit df99a1
Packit df99a1
/** This is the base object for all map areas. It defines some standard
Packit df99a1
    interface to access the geometrical properties of the areas and
Packit df99a1
    describes the area itsef:
Packit df99a1
    \begin{itemize}
Packit df99a1
       \item #url# If the optional #URL# is specified, the map area will
Packit df99a1
             also work as a hyperlink meaning that if you click it with
Packit df99a1
	     your mouse pointer, the browser will be advised to load
Packit df99a1
	     the page referenced by the #URL#.
Packit df99a1
       \item #target# Defines where the specified #URL# should be loaded
Packit df99a1
       \item #comment# This is a string displayed in a status line or in
Packit df99a1
             a popup window when the mouse pointer moves over the hyperlink
Packit df99a1
	     area
Packit df99a1
       \item #border_type#, #border_color# and #border_width# describes
Packit df99a1
             how the area border should be drawn
Packit df99a1
       \item #area_color# describes how the area should be highlighted.
Packit df99a1
    \end{itemize}
Packit df99a1
Packit df99a1
    The map areas can be displayed using two different techniques, which
Packit df99a1
    can be combined together:
Packit df99a1
    \begin{itemize}
Packit df99a1
       \item Visible border. The border of a map area can be drawn in several
Packit df99a1
             different ways (like #XOR_BORDER# or #SHADOW_IN_BORDER#).
Packit df99a1
	     It can be made always visible, or appearing only when the
Packit df99a1
	     mouse pointer moves over the map area.
Packit df99a1
       \item Highlighted contents. Contents of rectangular map areas can
Packit df99a1
             also be highlighted with some given color.
Packit df99a1
    \end{itemize}
Packit df99a1
*/
Packit df99a1
Packit df99a1
class GMapArea : public GPEnabled
Packit df99a1
{
Packit df99a1
protected:
Packit df99a1
   GMapArea(void);
Packit df99a1
public:
Packit df99a1
//      // Default creator.
Packit df99a1
//   static GP<GMapArea> create(void) {return new GMapArea();}
Packit df99a1
Packit df99a1
      /// Virtual destructor.
Packit df99a1
   virtual ~GMapArea();
Packit df99a1
Packit df99a1
   static const char MAPAREA_TAG [];
Packit df99a1
   static const char RECT_TAG [];
Packit df99a1
   static const char POLY_TAG [];
Packit df99a1
   static const char OVAL_TAG [];
Packit df99a1
   static const char NO_BORDER_TAG [];
Packit df99a1
   static const char XOR_BORDER_TAG [];
Packit df99a1
   static const char SOLID_BORDER_TAG [];
Packit df99a1
   static const char SHADOW_IN_BORDER_TAG [];
Packit df99a1
   static const char SHADOW_OUT_BORDER_TAG [];
Packit df99a1
   static const char SHADOW_EIN_BORDER_TAG [];
Packit df99a1
   static const char SHADOW_EOUT_BORDER_TAG [];
Packit df99a1
   static const char BORDER_AVIS_TAG [];
Packit df99a1
   static const char HILITE_TAG [];
Packit df99a1
   static const char URL_TAG [];
Packit df99a1
   static const char TARGET_SELF [];
Packit df99a1
Packit df99a1
   enum BorderType { NO_BORDER=0, XOR_BORDER=1, SOLID_BORDER=2,
Packit df99a1
		     SHADOW_IN_BORDER=3, SHADOW_OUT_BORDER=4,
Packit df99a1
		     SHADOW_EIN_BORDER=5, SHADOW_EOUT_BORDER=6 };
Packit df99a1
Packit df99a1
   enum Special_Hilite_Color{ NO_HILITE=0xFFFFFFFF, XOR_HILITE=0xFF000000};
Packit df99a1
Packit df99a1
   // Enumeration for reporting the type of map area. "MapUnknown" is reported
Packit df99a1
   // for objects of type GMapArea (there shouldn't be any).
Packit df99a1
   enum MapAreaType { UNKNOWN, RECT, OVAL, POLY };
Packit df99a1
Packit df99a1
      /** Optional URL which this map area can be associated with.
Packit df99a1
	  If it's not empty then clicking this map area with the mouse
Packit df99a1
	  will make the browser load the HTML page referenced by
Packit df99a1
	  this #url#.  Note: This may also be a relative URL, so the
Packit df99a1
          GURL class is not used. */
Packit df99a1
   GUTF8String	url;
Packit df99a1
      /** The target for the #URL#. Standard targets are:
Packit df99a1
	  \begin{itemize}
Packit df99a1
	     \item #_blank# - Load the link in a new blank window
Packit df99a1
	     \item #_self# - Load the link into the plugin window
Packit df99a1
	     \item #_top# - Load the link into the top-level frame
Packit df99a1
	  \end{itemize} */
Packit df99a1
   GUTF8String	target;
Packit df99a1
      /** Comment (displayed in a status line or as a popup hint when
Packit df99a1
	  the mouse pointer moves over the map area */
Packit df99a1
   GUTF8String	comment;
Packit df99a1
      /** Border type. Defines how the map area border should be drawn
Packit df99a1
	  \begin{itemize}
Packit df99a1
	     \item #NO_BORDER# - No border drawn
Packit df99a1
	     \item #XOR_BORDER# - The border is drawn using XOR method.
Packit df99a1
	     \item #SOLID_BORDER# - The border is drawn as a solid line
Packit df99a1
	           of a given color.
Packit df99a1
	     \item #SHADOW_IN_BORDER# - Supported for \Ref{GMapRect} only.
Packit df99a1
	     	   The map area area looks as if it was "pushed-in".
Packit df99a1
	     \item #SHADOW_OUT_BORDER# - The opposite of #SHADOW_OUT_BORDER#
Packit df99a1
	     \item #SHADOW_EIN_BORDER# - Also for \Ref{GMapRect} only.
Packit df99a1
	     	   Is translated as "shadow etched in"
Packit df99a1
	     \item #SHADOW_EOUT_BORDER# - The opposite of #SHADOW_EIN_BORDER#.
Packit df99a1
	  \end{itemize} */
Packit df99a1
   BorderType	border_type;
Packit df99a1
      /** If #TRUE#, the border will be made always visible. Otherwise
Packit df99a1
	  it will be drawn when the mouse moves over the map area. */
Packit df99a1
   bool		border_always_visible;
Packit df99a1
      /// Border color (when relevant) in #0x00RRGGBB# format
Packit df99a1
   unsigned long int	border_color;
Packit df99a1
      /// Border width in pixels
Packit df99a1
   int		border_width;
Packit df99a1
      /** Specified a color for highlighting the internal area of the map
Packit df99a1
	  area. Will work with rectangular map areas only. The color is
Packit df99a1
	  specified in \#00RRGGBB format. A special value of \#FFFFFFFF disables
Packit df99a1
          highlighting and \#FF000000 is for XOR highlighting. */
Packit df99a1
   unsigned long int	hilite_color;
Packit df99a1
Packit df99a1
      /// Returns 1 if the given point is inside the hyperlink area
Packit df99a1
   bool		is_point_inside(int x, int y) const;
Packit df99a1
Packit df99a1
      /// Returns xmin of the bounding rectangle
Packit df99a1
   int		get_xmin(void) const;
Packit df99a1
      /// Returns ymin of the bounding rectangle
Packit df99a1
   int		get_ymin(void) const;
Packit df99a1
      /** Returns xmax of the bounding rectangle. In other words, if #X# is
Packit df99a1
	  a coordinate of the last point in the right direction, the
Packit df99a1
	  function will return #X+1# */
Packit df99a1
   int		get_xmax(void) const;
Packit df99a1
      /** Returns xmax of the bounding rectangle. In other words, if #Y# is
Packit df99a1
	  a coordinate of the last point in the top direction, the
Packit df99a1
	  function will return #Y+1# */
Packit df99a1
   int		get_ymax(void) const;
Packit df99a1
      /// Returns the hyperlink bounding rectangle
Packit df99a1
   GRect	get_bound_rect(void) const;
Packit df99a1
      /** Moves the hyperlink along the given vector. Is used by the
Packit df99a1
	  hyperlinks editor. */
Packit df99a1
   void		move(int dx, int dy);
Packit df99a1
      /** Resizes the hyperlink to fit new bounding rectangle while
Packit df99a1
	  keeping the (xmin, ymin) points at rest. */
Packit df99a1
   void		resize(int new_width, int new_height);
Packit df99a1
      /** Transforms the hyperlink to be within the specified rectangle */
Packit df99a1
   void		transform(const GRect & grect);
Packit df99a1
      /** Checks if the object is OK. Especially useful with \Ref{GMapPoly}
Packit df99a1
	  where edges may intersect. If there is a problem it returns a
Packit df99a1
	  string describing it. */
Packit df99a1
   char const *	const check_object(void);
Packit df99a1
      /** Stores the contents of the hyperlink object in a lisp-like format
Packit df99a1
	  for saving into #ANTa# chunk (see \Ref{DjVuAnno}) */
Packit df99a1
   GUTF8String	print(void);
Packit df99a1
Packit df99a1
   virtual GUTF8String get_xmltag(const int height) const=0;
Packit df99a1
Packit df99a1
      /// Virtual function returning the shape type.
Packit df99a1
   virtual MapAreaType const get_shape_type( void ) const { return UNKNOWN; };
Packit df99a1
      /// Virtual function returning the shape name.
Packit df99a1
   virtual char const * const	get_shape_name(void) const=0;
Packit df99a1
      /// Virtual function generating a copy of this object
Packit df99a1
   virtual GP<GMapArea>	get_copy(void) const=0;
Packit df99a1
      /// Virtual function generating a list of defining coordinates
Packit df99a1
      /// (default are the opposite corners of the enclosing rectangle)
Packit df99a1
   virtual void get_coords( GList<int> & CoordList ) const;
Packit df99a1
   /// Virtual function maps maparea from one area to another using mapper
Packit df99a1
   virtual void map(GRectMapper &mapper)=0;
Packit df99a1
   /// Virtual function unmaps maparea from one area to another using mapper
Packit df99a1
   virtual void unmap(GRectMapper &mapper)=0;
Packit df99a1
Packit df99a1
protected:
Packit df99a1
   virtual int		gma_get_xmin(void) const=0;
Packit df99a1
   virtual int		gma_get_ymin(void) const=0;
Packit df99a1
   virtual int		gma_get_xmax(void) const=0;
Packit df99a1
   virtual int		gma_get_ymax(void) const=0;
Packit df99a1
   virtual void		gma_move(int dx, int dy)=0;
Packit df99a1
   virtual void		gma_resize(int new_width, int new_height)=0;
Packit df99a1
   virtual void		gma_transform(const GRect & grect)=0;
Packit df99a1
   virtual bool		gma_is_point_inside(const int x, const int y) const=0;
Packit df99a1
   virtual char const * const	gma_check_object(void) const=0;
Packit df99a1
   virtual GUTF8String	gma_print(void)=0;
Packit df99a1
   
Packit df99a1
   void		clear_bounds(void) { bounds_initialized=0; }
Packit df99a1
private:
Packit df99a1
   int		xmin, xmax, ymin, ymax;
Packit df99a1
   bool		bounds_initialized;
Packit df99a1
Packit df99a1
   void		initialize_bounds(void);
Packit df99a1
};
Packit df99a1
Packit df99a1
// ---------- GMAPRECT ---------
Packit df99a1
Packit df99a1
/** Implements rectangular map areas. This is the only kind of map areas
Packit df99a1
    supporting #SHADOW_IN_BORDER#, #SHADOW_OUT_BORDER#, #SHADOW_EIN_BORDER#
Packit df99a1
    and #SHADOW_EOUT_BORDER# types of border and area highlighting. */
Packit df99a1
Packit df99a1
class GMapRect: public GMapArea
Packit df99a1
{
Packit df99a1
protected:
Packit df99a1
   GMapRect(void);
Packit df99a1
   GMapRect(const GRect & rect);
Packit df99a1
public:
Packit df99a1
   /// Default creator.
Packit df99a1
   static GP<GMapRect> create(void) {return new GMapRect();}
Packit df99a1
   /// Create with the specified GRect.
Packit df99a1
   static GP<GMapRect> create(const GRect &rect) {return new GMapRect(rect);}
Packit df99a1
Packit df99a1
   virtual ~GMapRect();
Packit df99a1
Packit df99a1
      /// Returns the width of the rectangle
Packit df99a1
   int		get_width(void) const { return xmax-xmin; }
Packit df99a1
      /// Returns the height of the rectangle
Packit df99a1
   int		get_height(void) const { return ymax-ymin; }
Packit df99a1
Packit df99a1
      /// Changes the #GMapRect#'s geometry
Packit df99a1
   GMapRect & operator=(const GRect & rect);
Packit df99a1
Packit df99a1
      /// Returns \Ref{GRect} describing the map area's rectangle
Packit df99a1
   operator GRect(void);
Packit df99a1
   
Packit df99a1
   virtual GUTF8String get_xmltag(const int height) const;
Packit df99a1
      /// Returns MapRect
Packit df99a1
   virtual MapAreaType const get_shape_type( void ) const { return RECT; };
Packit df99a1
      /// Returns #"rect"#
Packit df99a1
   virtual char const * const	get_shape_name(void) const;
Packit df99a1
      /// Returns a copy of the rectangle
Packit df99a1
   virtual GP<GMapArea>	get_copy(void) const;
Packit df99a1
      /// Virtual function maps rectangle from one area to another using mapper
Packit df99a1
   virtual void map(GRectMapper &mapper);
Packit df99a1
      /// Virtual function unmaps rectangle from one area to another using mapper
Packit df99a1
   virtual void unmap(GRectMapper &mapper);
Packit df99a1
protected:
Packit df99a1
   int			xmin, ymin, xmax, ymax;
Packit df99a1
   virtual int		gma_get_xmin(void) const;
Packit df99a1
   virtual int		gma_get_ymin(void) const;
Packit df99a1
   virtual int		gma_get_xmax(void) const;
Packit df99a1
   virtual int		gma_get_ymax(void) const;
Packit df99a1
   virtual void		gma_move(int dx, int dy);
Packit df99a1
   virtual void		gma_resize(int new_width, int new_height);
Packit df99a1
   virtual void		gma_transform(const GRect & grect);
Packit df99a1
   virtual bool		gma_is_point_inside(const int x, const int y) const;
Packit df99a1
   virtual char const * const gma_check_object(void) const;
Packit df99a1
   virtual GUTF8String	gma_print(void);
Packit df99a1
};
Packit df99a1
Packit df99a1
// ---------- GMAPPOLY ---------
Packit df99a1
Packit df99a1
/** Implements polygonal map areas. The only supported types of border
Packit df99a1
    are #NO_BORDER#, #XOR_BORDER# and #SOLID_BORDER#. Its contents can not
Packit df99a1
    be highlighted either. It's worth mentioning here that despite its
Packit df99a1
    name the polygon may be open, which basically makes it a broken line.
Packit df99a1
    This very specific mode is used by the hyperlink editor when creating
Packit df99a1
    the polygonal hyperlink. */
Packit df99a1
Packit df99a1
class GMapPoly : public GMapArea
Packit df99a1
{
Packit df99a1
protected:
Packit df99a1
   GMapPoly(void);
Packit df99a1
   GMapPoly(const int * xx, const int * yy, int points, bool open=false);
Packit df99a1
public:
Packit df99a1
   /// Default creator
Packit df99a1
   static GP<GMapPoly> create(void) {return new GMapPoly();}
Packit df99a1
Packit df99a1
   /// Create from specified coordinates.
Packit df99a1
   static GP<GMapPoly> create(
Packit df99a1
     const int xx[], const int yy[], const int points, const bool open=false)
Packit df99a1
   {return new GMapPoly(xx,yy,points,open);}
Packit df99a1
Packit df99a1
   /// Virtual destructor.
Packit df99a1
   virtual ~GMapPoly();
Packit df99a1
Packit df99a1
      /// Returns 1 if side #side# crosses the specified rectangle #rect#.
Packit df99a1
   bool		does_side_cross_rect(const GRect & grect, int side);
Packit df99a1
Packit df99a1
      /// Returns the number of vertices in the polygon
Packit df99a1
   int		get_points_num(void) const;
Packit df99a1
Packit df99a1
      /// Returns the number sides in the polygon
Packit df99a1
   int		get_sides_num(void) const;
Packit df99a1
Packit df99a1
      /// Returns x coordinate of vertex number #i#
Packit df99a1
   int		get_x(int i) const;
Packit df99a1
   
Packit df99a1
      /// Returns y coordinate of vertex number #i#
Packit df99a1
   int		get_y(int i) const;
Packit df99a1
Packit df99a1
      /// Moves vertex #i# to position (#x#, #y#)
Packit df99a1
   void		move_vertex(int i, int x, int y);
Packit df99a1
Packit df99a1
      /// Adds a new vertex and returns number of vertices in the polygon
Packit df99a1
   int      add_vertex(int x, int y);
Packit df99a1
Packit df99a1
      /// Closes the polygon if it is not closed
Packit df99a1
   void     close_poly();
Packit df99a1
      /// Optimizes the polygon 
Packit df99a1
   void		optimize_data(void);
Packit df99a1
      /// Checks validity of the polygon 
Packit df99a1
   char const * const	check_data(void);
Packit df99a1
Packit df99a1
   virtual GUTF8String get_xmltag(const int height) const;
Packit df99a1
      /// Returns MapPoly
Packit df99a1
   virtual MapAreaType const get_shape_type( void ) const { return POLY; };
Packit df99a1
      /// Returns #"poly"# all the time
Packit df99a1
   virtual char const * const 	get_shape_name(void) const;
Packit df99a1
      /// Returns a copy of the polygon
Packit df99a1
   virtual GP<GMapArea>	get_copy(void) const;
Packit df99a1
      /// Virtual function generating a list of defining coordinates
Packit df99a1
   void get_coords( GList<int> & CoordList ) const;
Packit df99a1
      /// Virtual function maps polygon from one area to another using mapper
Packit df99a1
   virtual void map(GRectMapper &mapper);
Packit df99a1
   /// Virtual function unmaps polygon from one area to another using mapper
Packit df99a1
   virtual void unmap(GRectMapper &mapper);
Packit df99a1
protected:
Packit df99a1
   virtual int		gma_get_xmin(void) const;
Packit df99a1
   virtual int		gma_get_ymin(void) const;
Packit df99a1
   virtual int		gma_get_xmax(void) const;
Packit df99a1
   virtual int		gma_get_ymax(void) const;
Packit df99a1
   virtual void		gma_move(int dx, int dy);
Packit df99a1
   virtual void		gma_resize(int new_width, int new_height);
Packit df99a1
   virtual void		gma_transform(const GRect & grect);
Packit df99a1
   virtual bool		gma_is_point_inside(const int x, const int y) const;
Packit df99a1
   virtual char const * const gma_check_object(void) const;
Packit df99a1
   virtual GUTF8String	gma_print(void);
Packit df99a1
private:
Packit df99a1
   bool		open;
Packit df99a1
   int		points, sides;
Packit df99a1
   GTArray<int>	xx, yy;
Packit df99a1
   static int	sign(int x);
Packit df99a1
   static bool	is_projection_on_segment(int x, int y, int x1, int y1, int x2, int y2);
Packit df99a1
   static bool	do_segments_intersect(int x11, int y11, int x12, int y12,
Packit df99a1
				      int x21, int y21, int x22, int y22);
Packit df99a1
   static bool	are_segments_parallel(int x11, int y11, int x12, int y12,
Packit df99a1
				      int x21, int y21, int x22, int y22);
Packit df99a1
};
Packit df99a1
Packit df99a1
// ---------- GMAPOVAL ---------
Packit df99a1
Packit df99a1
/** Implements elliptical map areas. The only supported types of border
Packit df99a1
    are #NO_BORDER#, #XOR_BORDER# and #SOLID_BORDER#. Its contents can not
Packit df99a1
    be highlighted either. */
Packit df99a1
Packit df99a1
class GMapOval: public GMapArea
Packit df99a1
{
Packit df99a1
protected:
Packit df99a1
   GMapOval(void);
Packit df99a1
   GMapOval(const GRect & rect);
Packit df99a1
public:
Packit df99a1
   /// Default creator.
Packit df99a1
   static GP<GMapOval> create(void) {return new GMapOval();}
Packit df99a1
Packit df99a1
   /// Create from the specified GRect.
Packit df99a1
   static GP<GMapOval> create(const GRect &rect) {return new GMapOval(rect);}
Packit df99a1
Packit df99a1
   /// Virtual destructor. 
Packit df99a1
   virtual ~GMapOval();
Packit df99a1
Packit df99a1
      /// Returns (xmax-xmin)/2
Packit df99a1
   int		get_a(void) const;
Packit df99a1
      /// Returns (ymax-ymin)/2
Packit df99a1
   int		get_b(void) const;
Packit df99a1
      /// Returns the lesser of \Ref{get_a}() and \Ref{get_b}()
Packit df99a1
   int		get_rmin(void) const;
Packit df99a1
      /// Returns the greater of \Ref{get_a}() and \Ref{get_b}()
Packit df99a1
   int		get_rmax(void) const;
Packit df99a1
Packit df99a1
   virtual GUTF8String get_xmltag(const int height) const;
Packit df99a1
      /// Returns MapOval
Packit df99a1
   virtual MapAreaType const get_shape_type( void ) const { return OVAL; };
Packit df99a1
      /// Returns #"oval"#
Packit df99a1
   virtual char const * const get_shape_name(void) const;
Packit df99a1
      /// Returns a copy of the oval
Packit df99a1
   virtual GP<GMapArea>	get_copy(void) const;
Packit df99a1
      /// Virtual function maps oval from one area to another using mapper
Packit df99a1
   virtual void map(GRectMapper &mapper);
Packit df99a1
      /// Virtual function unmaps oval from one area to another using mapper
Packit df99a1
   virtual void unmap(GRectMapper &mapper);
Packit df99a1
protected:
Packit df99a1
   virtual int		gma_get_xmin(void) const;
Packit df99a1
   virtual int		gma_get_ymin(void) const;
Packit df99a1
   virtual int		gma_get_xmax(void) const;
Packit df99a1
   virtual int		gma_get_ymax(void) const;
Packit df99a1
   virtual void		gma_move(int dx, int dy);
Packit df99a1
   virtual void		gma_resize(int new_width, int new_height);
Packit df99a1
   virtual void		gma_transform(const GRect & grect);
Packit df99a1
   virtual bool		gma_is_point_inside(const int x, const int y) const;
Packit df99a1
   virtual char const * const	gma_check_object(void) const;
Packit df99a1
   virtual GUTF8String	gma_print(void);
Packit df99a1
private:
Packit df99a1
   int		rmax, rmin;
Packit df99a1
   int		a, b;
Packit df99a1
   int		xf1, yf1, xf2, yf2;
Packit df99a1
   int		xmin, ymin, xmax, ymax;
Packit df99a1
   
Packit df99a1
   void		initialize(void);
Packit df99a1
};
Packit df99a1
Packit df99a1
inline
Packit df99a1
GMapRect::operator GRect(void)
Packit df99a1
{
Packit df99a1
  return GRect(xmin, ymin, xmax-xmin, ymax-ymin);
Packit df99a1
}
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapRect::gma_get_xmin(void) const { return xmin; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapRect::gma_get_ymin(void) const { return ymin; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapRect::gma_get_xmax(void) const { return xmax; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapRect::gma_get_ymax(void) const { return ymax; }
Packit df99a1
Packit df99a1
inline char const * const
Packit df99a1
GMapRect::gma_check_object(void)  const{ return ""; }
Packit df99a1
Packit df99a1
inline char const * const 
Packit df99a1
GMapRect::get_shape_name(void) const { return RECT_TAG; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapPoly::get_points_num(void) const { return points; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapPoly::get_sides_num(void) const { return sides; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapPoly::get_x(int i) const { return xx[i]; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapPoly::get_y(int i) const { return yy[i]; }
Packit df99a1
Packit df99a1
inline char const * const
Packit df99a1
GMapPoly::get_shape_name(void) const { return POLY_TAG; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::get_a(void) const { return a; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::get_b(void) const { return b; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::get_rmin(void) const { return rmin; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::get_rmax(void) const { return rmax; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::gma_get_xmin(void) const { return xmin; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::gma_get_ymin(void) const { return ymin; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::gma_get_xmax(void) const { return xmax; }
Packit df99a1
Packit df99a1
inline int
Packit df99a1
GMapOval::gma_get_ymax(void) const { return ymax; }
Packit df99a1
Packit df99a1
inline char const * const
Packit df99a1
GMapOval::get_shape_name(void) const { return OVAL_TAG; }
Packit df99a1
Packit df99a1
//@}
Packit df99a1
Packit df99a1
Packit df99a1
#ifdef HAVE_NAMESPACES
Packit df99a1
}
Packit df99a1
# ifndef NOT_USING_DJVU_NAMESPACE
Packit df99a1
using namespace DJVU;
Packit df99a1
# endif
Packit df99a1
#endif
Packit df99a1
#endif