2012-01-14 19:50:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
/**
|
2011-09-20 13:57:40 +00:00
|
|
|
* @file class_edge_mod.h
|
2011-09-17 15:31:21 +00:00
|
|
|
* @brief EDGE_MODULE class definition.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
#ifndef CLASS_EDGE_MOD_H_
|
|
|
|
#define CLASS_EDGE_MOD_H_
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawsegment.h>
|
2011-01-14 17:43:30 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
class LINE_READER;
|
2011-09-17 15:31:21 +00:00
|
|
|
class EDA_3D_CANVAS;
|
2011-09-23 13:57:12 +00:00
|
|
|
class EDA_DRAW_FRAME;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-08-08 23:50:55 +00:00
|
|
|
class EDGE_MODULE : public DRAWSEGMENT
|
2007-08-06 20:26:59 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-09-17 15:31:21 +00:00
|
|
|
wxPoint m_Start0; // Start point or center, relative to module origin, orient 0.
|
2010-07-11 16:24:44 +00:00
|
|
|
wxPoint m_End0; // End point, relative to module origin, orient 0.
|
2008-02-22 17:34:11 +00:00
|
|
|
|
2007-08-06 20:26:59 +00:00
|
|
|
public:
|
2011-12-01 22:50:41 +00:00
|
|
|
EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
|
|
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
|
|
|
|
2007-08-06 20:26:59 +00:00
|
|
|
~EDGE_MODULE();
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
EDGE_MODULE* Next() const { return (EDGE_MODULE*) Pnext; }
|
|
|
|
EDGE_MODULE* Back() const { return (EDGE_MODULE*) Pback; }
|
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
void Copy( EDGE_MODULE* source ); // copy structure
|
|
|
|
|
|
|
|
void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
|
|
|
|
const wxPoint& GetStart0() const { return m_Start0; }
|
|
|
|
|
|
|
|
void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; }
|
|
|
|
const wxPoint& GetEnd0() const { return m_End0; }
|
2007-08-06 20:26:59 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2007-10-31 14:14:21 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
2007-10-30 21:30:58 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
2008-02-22 17:34:11 +00:00
|
|
|
*/
|
2011-09-17 15:31:21 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-02-22 17:34:11 +00:00
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
int ReadDescr( LINE_READER* aReader );
|
2007-08-06 20:26:59 +00:00
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
void SetDrawCoord();
|
2007-08-06 20:26:59 +00:00
|
|
|
|
|
|
|
/* drawing functions */
|
2011-09-17 15:31:21 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
|
|
|
|
int aDrawMode, const wxPoint& offset = ZeroOffset );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2011-09-17 15:31:21 +00:00
|
|
|
void Draw3D( EDA_3D_CANVAS* glcanvas );
|
2007-08-20 19:33:15 +00:00
|
|
|
|
|
|
|
/**
|
2009-04-17 08:51:02 +00:00
|
|
|
* Function DisplayInfo
|
2007-08-20 19:33:15 +00:00
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
2010-12-08 20:12:46 +00:00
|
|
|
* Is virtual from EDA_ITEM.
|
2011-01-21 19:30:59 +00:00
|
|
|
* @param frame A EDA_DRAW_FRAME in which to print status information.
|
2008-02-22 17:34:11 +00:00
|
|
|
*/
|
2011-09-17 15:31:21 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* frame );
|
2008-02-22 17:34:11 +00:00
|
|
|
|
2007-08-07 06:21:19 +00:00
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
return wxT( "MGRAPHIC" );
|
2010-07-11 16:24:44 +00:00
|
|
|
|
2007-08-07 06:21:19 +00:00
|
|
|
// return wxT( "EDGE" ); ?
|
|
|
|
}
|
|
|
|
|
2011-07-14 15:42:44 +00:00
|
|
|
virtual wxString GetSelectMenuText() const;
|
2008-05-05 19:53:31 +00:00
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
virtual BITMAP_DEF GetMenuImage() const { return show_mod_edge_xpm; }
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
#if defined(DEBUG)
|
2011-12-14 17:25:42 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os ) const; // overload
|
2007-08-06 20:26:59 +00:00
|
|
|
#endif
|
2012-01-14 19:50:32 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
#endif // CLASS_EDGE_MOD_H_
|