mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00

Conflicts: qucs-core/ChangeLog qucs-core/NEWS qucs-core/README qucs-core/RELEASE qucs-core/autodsp.sh qucs-core/configure.ac qucs-core/src/ChangeLog qucs-core/src/acsolver.cpp qucs-core/src/acsolver.h qucs-core/src/analyses.h qucs-core/src/analysis.cpp qucs-core/src/analysis.h qucs-core/src/applications.h qucs-core/src/characteristic.cpp qucs-core/src/characteristic.h qucs-core/src/check_citi.cpp qucs-core/src/check_citi.h qucs-core/src/check_csv.cpp qucs-core/src/check_csv.h qucs-core/src/check_dataset.cpp qucs-core/src/check_dataset.h qucs-core/src/check_mdl.cpp qucs-core/src/check_mdl.h qucs-core/src/check_netlist.cpp qucs-core/src/check_netlist.h qucs-core/src/check_touchstone.cpp qucs-core/src/check_touchstone.h qucs-core/src/check_zvr.cpp qucs-core/src/check_zvr.h qucs-core/src/circuit.cpp qucs-core/src/circuit.h qucs-core/src/compat.h qucs-core/src/components/ChangeLog qucs-core/src/components/Makefile.am qucs-core/src/components/amplifier.cpp qucs-core/src/components/amplifier.h qucs-core/src/components/attenuator.cpp qucs-core/src/components/attenuator.h qucs-core/src/components/biastee.cpp qucs-core/src/components/biastee.h qucs-core/src/components/capacitor.cpp qucs-core/src/components/capacitor.h qucs-core/src/components/cccs.cpp qucs-core/src/components/cccs.h qucs-core/src/components/ccvs.cpp qucs-core/src/components/ccvs.h qucs-core/src/components/circulator.cpp qucs-core/src/components/circulator.h qucs-core/src/components/coaxline.cpp qucs-core/src/components/coaxline.h qucs-core/src/components/component.h qucs-core/src/components/component_id.h qucs-core/src/components/components.h qucs-core/src/components/coupler.cpp qucs-core/src/components/coupler.h qucs-core/src/components/cross.cpp qucs-core/src/components/cross.h qucs-core/src/components/dcblock.cpp qucs-core/src/components/dcblock.h qucs-core/src/components/dcfeed.cpp qucs-core/src/components/dcfeed.h qucs-core/src/components/devices/Makefile.am qucs-core/src/components/devices/bjt.cpp qucs-core/src/components/devices/bjt.h qucs-core/src/components/devices/device.cpp qucs-core/src/components/devices/device.h qucs-core/src/components/devices/diac.cpp qucs-core/src/components/devices/diac.h qucs-core/src/components/devices/diode.cpp qucs-core/src/components/devices/diode.h qucs-core/src/components/devices/eqndefined.cpp qucs-core/src/components/devices/eqndefined.h qucs-core/src/components/devices/jfet.cpp qucs-core/src/components/devices/jfet.h qucs-core/src/components/devices/libdevices.ap qucs-core/src/components/devices/mosfet.cpp qucs-core/src/components/devices/mosfet.h qucs-core/src/components/devices/thyristor.cpp qucs-core/src/components/devices/thyristor.h qucs-core/src/components/devices/triac.cpp qucs-core/src/components/devices/triac.h qucs-core/src/components/digital/and.cpp qucs-core/src/components/digital/and.h qucs-core/src/components/digital/buffer.cpp qucs-core/src/components/digital/buffer.h qucs-core/src/components/digital/digisource.cpp qucs-core/src/components/digital/digisource.h qucs-core/src/components/digital/digital.cpp qucs-core/src/components/digital/digital.h qucs-core/src/components/digital/inverter.cpp qucs-core/src/components/digital/inverter.h qucs-core/src/components/digital/nand.cpp qucs-core/src/components/digital/nand.h qucs-core/src/components/digital/nor.cpp qucs-core/src/components/digital/nor.h qucs-core/src/components/digital/or.cpp qucs-core/src/components/digital/or.h qucs-core/src/components/digital/xnor.cpp qucs-core/src/components/digital/xnor.h qucs-core/src/components/digital/xor.cpp qucs-core/src/components/digital/xor.h qucs-core/src/components/ground.cpp qucs-core/src/components/ground.h qucs-core/src/components/gyrator.cpp qucs-core/src/components/gyrator.h qucs-core/src/components/iac.cpp qucs-core/src/components/iac.h qucs-core/src/components/idc.cpp qucs-core/src/components/idc.h qucs-core/src/components/iexp.cpp qucs-core/src/components/iexp.h qucs-core/src/components/ifile.cpp qucs-core/src/components/ifile.h qucs-core/src/components/iinoise.cpp qucs-core/src/components/iinoise.h qucs-core/src/components/inductor.cpp qucs-core/src/components/inductor.h qucs-core/src/components/inoise.cpp qucs-core/src/components/inoise.h qucs-core/src/components/iprobe.cpp qucs-core/src/components/iprobe.h qucs-core/src/components/ipulse.cpp qucs-core/src/components/ipulse.h qucs-core/src/components/irect.cpp qucs-core/src/components/irect.h qucs-core/src/components/isolator.cpp qucs-core/src/components/isolator.h qucs-core/src/components/itrafo.cpp qucs-core/src/components/itrafo.h qucs-core/src/components/ivnoise.cpp qucs-core/src/components/ivnoise.h qucs-core/src/components/libcomponent.ap qucs-core/src/components/microstrip/bondwire.cpp qucs-core/src/components/microstrip/bondwire.h qucs-core/src/components/microstrip/cpwgap.cpp qucs-core/src/components/microstrip/cpwgap.h qucs-core/src/components/microstrip/cpwline.cpp qucs-core/src/components/microstrip/cpwline.h qucs-core/src/components/microstrip/cpwopen.cpp qucs-core/src/components/microstrip/cpwopen.h qucs-core/src/components/microstrip/cpwshort.cpp qucs-core/src/components/microstrip/cpwshort.h qucs-core/src/components/microstrip/cpwstep.cpp qucs-core/src/components/microstrip/cpwstep.h qucs-core/src/components/microstrip/mscorner.cpp qucs-core/src/components/microstrip/mscorner.h qucs-core/src/components/microstrip/mscoupled.cpp qucs-core/src/components/microstrip/mscoupled.h qucs-core/src/components/microstrip/mscross.cpp qucs-core/src/components/microstrip/mscross.h qucs-core/src/components/microstrip/msgap.cpp qucs-core/src/components/microstrip/msgap.h qucs-core/src/components/microstrip/msline.cpp qucs-core/src/components/microstrip/msline.h qucs-core/src/components/microstrip/msmbend.cpp qucs-core/src/components/microstrip/msmbend.h qucs-core/src/components/microstrip/msopen.cpp qucs-core/src/components/microstrip/msopen.h qucs-core/src/components/microstrip/msrstub.cpp qucs-core/src/components/microstrip/msrstub.h qucs-core/src/components/microstrip/msstep.cpp qucs-core/src/components/microstrip/msstep.h qucs-core/src/components/microstrip/mstee.cpp qucs-core/src/components/microstrip/mstee.h qucs-core/src/components/microstrip/msvia.cpp qucs-core/src/components/microstrip/msvia.h qucs-core/src/components/microstrip/substrate.cpp qucs-core/src/components/microstrip/substrate.h qucs-core/src/components/mutual.cpp qucs-core/src/components/mutual.h qucs-core/src/components/mutual2.cpp qucs-core/src/components/mutual2.h qucs-core/src/components/mutualx.cpp qucs-core/src/components/mutualx.h qucs-core/src/components/opamp.cpp qucs-core/src/components/opamp.h qucs-core/src/components/open.cpp qucs-core/src/components/open.h qucs-core/src/components/pac.cpp qucs-core/src/components/pac.h qucs-core/src/components/phaseshifter.cpp qucs-core/src/components/phaseshifter.h qucs-core/src/components/rectline.cpp qucs-core/src/components/relais.cpp qucs-core/src/components/relais.h qucs-core/src/components/resistor.cpp qucs-core/src/components/resistor.h qucs-core/src/components/rfedd.cpp qucs-core/src/components/rfedd.h qucs-core/src/components/rlcg.cpp qucs-core/src/components/rlcg.h qucs-core/src/components/short.cpp qucs-core/src/components/short.h qucs-core/src/components/spfile.cpp qucs-core/src/components/spfile.h qucs-core/src/components/strafo.cpp qucs-core/src/components/strafo.h qucs-core/src/components/tee.cpp qucs-core/src/components/tee.h qucs-core/src/components/tline.cpp qucs-core/src/components/tline.h qucs-core/src/components/tline4p.cpp qucs-core/src/components/tline4p.h qucs-core/src/components/trafo.cpp qucs-core/src/components/trafo.h qucs-core/src/components/tswitch.cpp qucs-core/src/components/tswitch.h qucs-core/src/components/twistedpair.cpp qucs-core/src/components/twistedpair.h qucs-core/src/components/vac.cpp qucs-core/src/components/vac.h qucs-core/src/components/vam.cpp qucs-core/src/components/vam.h qucs-core/src/components/vccs.cpp qucs-core/src/components/vccs.h qucs-core/src/components/vcvs.cpp qucs-core/src/components/vcvs.h qucs-core/src/components/vdc.cpp qucs-core/src/components/vdc.h qucs-core/src/components/verilog/ChangeLog qucs-core/src/components/verilog/Makefile.am qucs-core/src/components/verilog/constants.vams qucs-core/src/components/verilog/disciplines.vams qucs-core/src/components/vexp.cpp qucs-core/src/components/vexp.h qucs-core/src/components/vfile.cpp qucs-core/src/components/vfile.h qucs-core/src/components/vnoise.cpp qucs-core/src/components/vnoise.h qucs-core/src/components/vpm.cpp qucs-core/src/components/vpm.h qucs-core/src/components/vprobe.cpp qucs-core/src/components/vprobe.h qucs-core/src/components/vpulse.cpp qucs-core/src/components/vpulse.h qucs-core/src/components/vrect.cpp qucs-core/src/components/vrect.h qucs-core/src/components/vvnoise.cpp qucs-core/src/components/vvnoise.h qucs-core/src/constants.h qucs-core/src/consts.h qucs-core/src/converter/ChangeLog qucs-core/src/converter/check_spice.cpp qucs-core/src/converter/check_spice.h qucs-core/src/converter/check_vcd.cpp qucs-core/src/converter/check_vcd.h qucs-core/src/converter/csv_producer.cpp qucs-core/src/converter/csv_producer.h qucs-core/src/converter/matlab_producer.cpp qucs-core/src/converter/matlab_producer.h qucs-core/src/converter/parse_spice.y qucs-core/src/converter/parse_vcd.y qucs-core/src/converter/qucs_producer.cpp qucs-core/src/converter/qucs_producer.h qucs-core/src/converter/qucsconv.cpp qucs-core/src/converter/scan_spice.l qucs-core/src/converter/scan_vcd.l qucs-core/src/converter/touchstone_producer.cpp qucs-core/src/converter/touchstone_producer.h qucs-core/src/dataset.cpp qucs-core/src/dataset.h qucs-core/src/dcsolver.cpp qucs-core/src/dcsolver.h qucs-core/src/devstates.cpp qucs-core/src/devstates.h qucs-core/src/differentiate.cpp qucs-core/src/differentiate.h qucs-core/src/environment.cpp qucs-core/src/environment.h qucs-core/src/eqnsys.cpp qucs-core/src/eqnsys.h qucs-core/src/equation.cpp qucs-core/src/equation.h qucs-core/src/evaluate.cpp qucs-core/src/evaluate.h qucs-core/src/exception.cpp qucs-core/src/exception.h qucs-core/src/exceptionstack.cpp qucs-core/src/exceptionstack.h qucs-core/src/fourier.cpp qucs-core/src/fourier.h qucs-core/src/gperfappgen.cpp qucs-core/src/hash.cpp qucs-core/src/hash.h qucs-core/src/hbsolver.cpp qucs-core/src/hbsolver.h qucs-core/src/history.cpp qucs-core/src/history.h qucs-core/src/input.cpp qucs-core/src/input.h qucs-core/src/integrator.cpp qucs-core/src/integrator.h qucs-core/src/interpolator.cpp qucs-core/src/interpolator.h qucs-core/src/libqucsator.h qucs-core/src/logging.c qucs-core/src/logging.h qucs-core/src/math/cbesselj.cpp qucs-core/src/math/cmplx.cpp qucs-core/src/math/cmplx.h qucs-core/src/math/complex.cpp qucs-core/src/math/complex.h qucs-core/src/math/fspecial.cpp qucs-core/src/math/fspecial.h qucs-core/src/math/precision.c qucs-core/src/math/precision.h qucs-core/src/math/real.cpp qucs-core/src/math/real.h qucs-core/src/matrix.cpp qucs-core/src/matrix.h qucs-core/src/matvec.cpp qucs-core/src/matvec.h qucs-core/src/module.cpp qucs-core/src/module.h qucs-core/src/nasolution.cpp qucs-core/src/nasolution.h qucs-core/src/nasolver.cpp qucs-core/src/nasolver.h qucs-core/src/net.cpp qucs-core/src/net.h qucs-core/src/netdefs.h qucs-core/src/node.cpp qucs-core/src/node.h qucs-core/src/nodelist.cpp qucs-core/src/nodelist.h qucs-core/src/nodeset.cpp qucs-core/src/nodeset.h qucs-core/src/object.cpp qucs-core/src/object.h qucs-core/src/operatingpoint.cpp qucs-core/src/operatingpoint.h qucs-core/src/pair.cpp qucs-core/src/pair.h qucs-core/src/parasweep.cpp qucs-core/src/parasweep.h qucs-core/src/parse_citi.y qucs-core/src/parse_csv.y qucs-core/src/parse_dataset.y qucs-core/src/parse_mdl.y qucs-core/src/parse_netlist.y qucs-core/src/parse_touchstone.y qucs-core/src/parse_zvr.y qucs-core/src/poly.h qucs-core/src/property.cpp qucs-core/src/property.h qucs-core/src/ptrlist.cpp qucs-core/src/ptrlist.h qucs-core/src/range.cpp qucs-core/src/range.h qucs-core/src/receiver.cpp qucs-core/src/receiver.h qucs-core/src/scan_citi.l qucs-core/src/scan_csv.l qucs-core/src/scan_dataset.l qucs-core/src/scan_mdl.l qucs-core/src/scan_netlist.l qucs-core/src/scan_touchstone.l qucs-core/src/scan_zvr.l qucs-core/src/spline.cpp qucs-core/src/spline.h qucs-core/src/spsolver.cpp qucs-core/src/spsolver.h qucs-core/src/states.cpp qucs-core/src/states.h qucs-core/src/strlist.cpp qucs-core/src/strlist.h qucs-core/src/sweep.cpp qucs-core/src/sweep.h qucs-core/src/tmatrix.cpp qucs-core/src/tmatrix.h qucs-core/src/transient.cpp qucs-core/src/transient.h qucs-core/src/tridiag.cpp qucs-core/src/tridiag.h qucs-core/src/trsolver.cpp qucs-core/src/trsolver.h qucs-core/src/tvector.cpp qucs-core/src/tvector.h qucs-core/src/ucs.cpp qucs-core/src/valuelist.cpp qucs-core/src/valuelist.h qucs-core/src/variable.cpp qucs-core/src/variable.h qucs-core/src/vector.cpp qucs-core/src/vector.h qucs-doc/NEWS qucs-doc/README qucs-doc/RELEASE qucs-doc/technical/ChangeLog qucs-doc/technical/transline.tex qucs-doc/tutorial/equations/content.tex qucs/ChangeLog qucs/NEWS qucs/README qucs/RELEASE qucs/autodsp.sh qucs/configure.ac qucs/contrib/innosetup/freehdl.iss qucs/contrib/innosetup/qucs.iss qucs/qucs-help/ChangeLog qucs/qucs-help/docs/en/Makefile.am qucs/qucs-help/docs/en/index.html qucs/qucs-lib/ChangeLog qucs/qucs-lib/library/Ideal.lib qucs/qucs-lib/symbolwidget.cpp qucs/qucs-transcalc/ChangeLog qucs/qucs-transcalc/coax.cpp qucs/qucs-transcalc/rectwaveguide.cpp qucs/qucs/ChangeLog qucs/qucs/Makefile.am qucs/qucs/bitmaps/Makefile.am qucs/qucs/bitmaps/photodiode.png qucs/qucs/bitmaps/phototransistor.png qucs/qucs/components/ChangeLog qucs/qucs/components/Makefile.am qucs/qucs/components/component.cpp qucs/qucs/components/components.h qucs/qucs/components/libcomponents.ap qucs/qucs/components/mslange.cpp qucs/qucs/diagrams/graph.cpp qucs/qucs/dialogs/settingsdialog.cpp qucs/qucs/dialogs/settingsdialog.h qucs/qucs/dialogs/simmessage.cpp qucs/qucs/dialogs/simmessage.h qucs/qucs/main.cpp qucs/qucs/main.h qucs/qucs/module.cpp qucs/qucs/paintings/graphictext.cpp qucs/qucs/qucs.ap qucs/qucs/qucs.cpp qucs/qucs/qucs.h qucs/qucs/qucs_ar.ts qucs/qucs/qucs_ca.ts qucs/qucs/qucs_cs.ts qucs/qucs/qucs_de.ts qucs/qucs/qucs_es.ts qucs/qucs/qucs_fr.ts qucs/qucs/qucs_he.ts qucs/qucs/qucs_hu.ts qucs/qucs/qucs_init.cpp qucs/qucs/qucs_it.ts qucs/qucs/qucs_jp.ts qucs/qucs/qucs_kk.ts qucs/qucs/qucs_pl.ts qucs/qucs/qucs_pt.ts qucs/qucs/qucs_ro.ts qucs/qucs/qucs_ru.ts qucs/qucs/qucs_sv.ts qucs/qucs/qucs_tr.ts qucs/qucs/qucs_uk.ts qucs/qucs/qucsdigi.bat qucs/qucs/qucsdigilib.bat qucs/qucs/qucsdoc.cpp qucs/qucs/qucsdoc.h qucs/qucs/schematic.cpp qucs/qucs/schematic_file.cpp qucs/qucs/syntax.cpp qucs/qucs/syntax.h qucs/qucs/textdoc.cpp
263 lines
6.7 KiB
C++
263 lines
6.7 KiB
C++
/***************************************************************************
|
|
graph.cpp - description
|
|
-------------------
|
|
begin : Thu Oct 2 2003
|
|
copyright : (C) 2003 by Michael Margraf
|
|
email : michael.margraf@alumni.tu-berlin.de
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* *
|
|
* 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. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#include "graph.h"
|
|
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
|
|
|
|
Graph::Graph(const QString& _Line)
|
|
{
|
|
Type = isGraph;
|
|
|
|
Var = _Line;
|
|
countY = 0; // no points in graph
|
|
Thick = numMode = 0;
|
|
Color = 0x0000ff; // blue
|
|
Style = 0; // solid line
|
|
Precision = 3;
|
|
isSelected = false;
|
|
yAxisNo = 0; // left y axis
|
|
|
|
ScrPoints = 0;
|
|
cPointsY = 0;
|
|
|
|
Markers.setAutoDelete(true);
|
|
cPointsX.setAutoDelete(true);
|
|
}
|
|
|
|
Graph::~Graph()
|
|
{
|
|
if(ScrPoints != 0)
|
|
free(ScrPoints);
|
|
if(cPointsY != 0)
|
|
delete[] cPointsY;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
void Graph::paint(ViewPainter *p, int x0, int y0)
|
|
{
|
|
if(ScrPoints == 0)
|
|
return;
|
|
|
|
if(isSelected) {
|
|
p->Painter->setPen(QPen(QPen::darkGray,Thick*p->PrintScale+4));
|
|
paintLines(p, x0, y0);
|
|
|
|
p->Painter->setPen(QPen(QPen::white, Thick*p->PrintScale, Qt::SolidLine));
|
|
paintLines(p, x0, y0);
|
|
return;
|
|
}
|
|
|
|
// **** not selected ****
|
|
p->Painter->setPen(QPen(QColor(Color), Thick*p->PrintScale, Qt::SolidLine));
|
|
paintLines(p, x0, y0);
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
void Graph::paintLines(ViewPainter *p, int x0, int y0)
|
|
{
|
|
switch(Style) {
|
|
case GRAPHSTYLE_STAR:
|
|
p->drawStarSymbols(x0, y0, ScrPoints);
|
|
break;
|
|
case GRAPHSTYLE_CIRCLE:
|
|
p->drawCircleSymbols(x0, y0, ScrPoints);
|
|
break;
|
|
case GRAPHSTYLE_ARROW:
|
|
p->drawArrowSymbols(x0, y0, ScrPoints);
|
|
break;
|
|
default:
|
|
p->drawLines(x0, y0, ScrPoints);
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
QString Graph::save()
|
|
{
|
|
QString s = "\t<\""+Var+"\" "+Color.name()+
|
|
" "+QString::number(Thick)+" "+QString::number(Precision)+
|
|
" "+QString::number(numMode)+" "+QString::number(Style)+
|
|
" "+QString::number(yAxisNo)+">";
|
|
|
|
for(Marker *pm=Markers.first(); pm != 0; pm=Markers.next())
|
|
s += "\n\t "+pm->save();
|
|
|
|
return s;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
bool Graph::load(const QString& _s)
|
|
{
|
|
bool ok;
|
|
QString s = _s;
|
|
|
|
if(s.at(0) != '<') return false;
|
|
if(s.at(s.length()-1) != '>') return false;
|
|
s = s.mid(1, s.length()-2); // cut off start and end character
|
|
|
|
Var = s.section('"',1,1); // Var
|
|
|
|
QString n;
|
|
n = s.section(' ',1,1); // Color
|
|
Color.setNamedColor(n);
|
|
if(!Color.isValid()) return false;
|
|
|
|
n = s.section(' ',2,2); // Thick
|
|
Thick = n.toInt(&ok);
|
|
if(!ok) return false;
|
|
|
|
n = s.section(' ',3,3); // Precision
|
|
Precision = n.toInt(&ok);
|
|
if(!ok) return false;
|
|
|
|
n = s.section(' ',4,4); // numMode
|
|
numMode = n.toInt(&ok);
|
|
if(!ok) return false;
|
|
|
|
n = s.section(' ',5,5); // Style
|
|
Style = n.toInt(&ok);
|
|
if(!ok) return false;
|
|
|
|
n = s.section(' ',6,6); // yAxisNo
|
|
if(n.isEmpty()) return true; // backward compatible
|
|
yAxisNo = n.toInt(&ok);
|
|
if(!ok) return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
// Checks if the coordinates x/y point to the graph. x/y are relative to
|
|
// diagram cx/cy. 5 is the precision the user must point onto the graph.
|
|
int Graph::getSelected(int x, int y)
|
|
{
|
|
float *pp = ScrPoints;
|
|
if(pp == 0) return -1;
|
|
|
|
int A, z=0;
|
|
int dx, dx2, x1;
|
|
int dy, dy2, y1;
|
|
|
|
int countX = cPointsX.getFirst()->count;
|
|
if(*pp <= STROKEEND) {
|
|
if(*pp <= BRANCHEND) z++;
|
|
pp++;
|
|
if(*pp <= BRANCHEND) {
|
|
<<<<<<< HEAD
|
|
=======
|
|
if(*pp <= GRAPHEND) return -1; // not even one point ?
|
|
>>>>>>> 80028cb8206ee83926db69b5bd20c9a3c932403d
|
|
z++;
|
|
pp++;
|
|
if(*pp < BRANCHEND) return -1; // not even one point ?
|
|
}
|
|
}
|
|
|
|
<<<<<<< HEAD
|
|
|
|
=======
|
|
>>>>>>> 80028cb8206ee83926db69b5bd20c9a3c932403d
|
|
if(Style >= GRAPHSTYLE_STAR) {
|
|
// for graph symbols
|
|
while(*pp > GRAPHEND) {
|
|
if(*pp > STROKEEND) {
|
|
dx = x - int(*(pp++));
|
|
dy = y - int(*(pp++));
|
|
|
|
if(dx < -5) continue;
|
|
if(dx > 5) continue;
|
|
if(dy < -5) continue;
|
|
if(dy > 5) continue;
|
|
return z*countX; // points on graph symbol
|
|
}
|
|
else {
|
|
z++; // next branch
|
|
pp++;
|
|
}
|
|
}
|
|
<<<<<<< HEAD
|
|
|
|
return -1;
|
|
}
|
|
|
|
|
|
|
|
=======
|
|
return -1;
|
|
}
|
|
|
|
>>>>>>> 80028cb8206ee83926db69b5bd20c9a3c932403d
|
|
// for graph lines
|
|
while(*pp > GRAPHEND) {
|
|
while(*pp >= STROKEEND) {
|
|
x1 = int(*(pp++));
|
|
y1 = int(*(pp++));
|
|
dx = x - x1;
|
|
dy = y - y1;
|
|
|
|
dx2 = int(*pp);
|
|
if(dx2 <= STROKEEND) { // end of stroke ?
|
|
if(dx2 <= BRANCHEND) break;
|
|
pp++;
|
|
dx2 = int(*pp); // go on as graph can also be selected between strokes
|
|
if(dx2 <= BRANCHEND) break;
|
|
}
|
|
if(dx < -5) { if(x < dx2-5) continue; } // point between x coordinates ?
|
|
else { if(x > 5) if(x > dx2+5) continue; }
|
|
|
|
dy2 = int(*(pp+1));
|
|
if(dy < -5) { if(y < dy2-5) continue; } // point between y coordinates ?
|
|
else { if(y > 5) if(y > dy2+5) continue; }
|
|
|
|
dx2 -= x1;
|
|
dy2 -= y1;
|
|
|
|
A = dx2*dy - dx*dy2; // calculate the rectangle area spanned
|
|
A *= A; // avoid the need for square root
|
|
A -= 25*(dx2*dx2 + dy2*dy2); // substract selectable area
|
|
|
|
if(A <= 0) return z*countX; // lies x/y onto the graph line ?
|
|
}
|
|
pp++;
|
|
z++;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
// Creates a new graph and copies all the properties into it.
|
|
Graph* Graph::sameNewOne()
|
|
{
|
|
Graph *pg = new Graph(Var);
|
|
|
|
pg->Color = Color;
|
|
pg->Thick = Thick;
|
|
pg->Style = Style;
|
|
|
|
pg->Precision = Precision;
|
|
pg->numMode = numMode;
|
|
pg->yAxisNo = yAxisNo;
|
|
|
|
for(Marker *pm = Markers.first(); pm != 0; pm = Markers.next())
|
|
pg->Markers.append(pm->sameNewOne(pg));
|
|
|
|
return pg;
|
|
}
|