[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kalgebra
From:       Aleix Pol Gonzalez <aleixpol () gmail ! com>
Date:       2010-09-01 17:10:01
Message-ID: 20100901171001.5C1E5AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1170619 by apol:

Ported the missing bits from Percy's branch to KAlgebra to make implicit work smoothly.

CCMAIL: percy.camilo.ta@gmail.com


 M  +4 -0      analitzagui/function.cpp  
 M  +2 -0      analitzagui/function.h  
 M  +6 -0      analitzagui/functionimpl.h  
 M  +12 -2     src/graph2d.cpp  


--- trunk/KDE/kdeedu/kalgebra/analitzagui/function.cpp #1170618:1170619
@@ -175,3 +175,7 @@
 	return m_function->m_jumps;
 }
 
+bool function::allDisconnected() const
+{
+    return m_function->allDisconnected();
+}
--- trunk/KDE/kdeedu/kalgebra/analitzagui/function.h #1170618:1170619
@@ -119,6 +119,8 @@
 		void setUplimit(const Analitza::Expression& e);
 		void setDownlimit(const Analitza::Expression& e);
 		
+		bool allDisconnected() const;
+		
 	private:
 		FunctionImpl* m_function;
 		Analitza::Expression m_expression;
--- trunk/KDE/kdeedu/kalgebra/analitzagui/functionimpl.h #1170618:1170619
@@ -48,6 +48,12 @@
     virtual QLineF derivative(const QPointF& p)=0;
 	virtual QStringList boundings() const=0;
 	
+	/** 
+	 * @returns whether the points vector contains segments (all disconnected is true)
+	 * or continuous lines (all disconnected is false).
+	 */
+	virtual bool allDisconnected() { return false; }
+	
 	double uplimit() const;
 	double downlimit() const;
 	void setLimits(double downlimit, double uplimit);
--- trunk/KDE/kdeedu/kalgebra/src/graph2d.cpp #1170618:1170619
@@ -213,7 +213,6 @@
 	finestra.setRenderHint(QPainter::Antialiasing, true);
 	
 	int k=0;
-	QRectF panorama(QPoint(0,0), size());
 	FunctionsModel::const_iterator it=m_model->constBegin(), itEnd=m_model->constEnd();
 	for (; it!=itEnd; ++it, ++k ) {
 		if(!it->isShown())
@@ -228,7 +227,13 @@
 		unsigned int pointsCount = vect.count();
 		QPointF ultim(toWidget(vect[0]));
 		
-		int nextjump= jumps.isEmpty() ? -1 : jumps.takeFirst();
+		bool allJumps = it->allDisconnected();
+		int nextjump;
+		if(allJumps)
+			nextjump = 0;
+		else
+			nextjump = jumps.isEmpty() ? -1 : jumps.takeFirst();
+        
 #ifdef DEBUG_GRAPH
 		qDebug() << "---------" << jumps.count()+1;
 #endif
@@ -266,7 +271,12 @@
 				do {
 					if(nextjump!=int(j))
 						finestra.drawPoint(act);
+					
+					if(allJumps)
+						nextjump += 2;
+					else
 					nextjump=jumps.isEmpty() ? -1 : jumps.takeFirst();
+					
 				} while(!jumps.isEmpty() && jumps.first()==nextjump+1);
 				
 #ifdef DEBUG_GRAPH
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic