This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OGRLineString * convertFromGEOStoOGR(LineString * ls) { | |
OGRLineString * lineString = (OGRLineString*) OGRGeometryFactory::createGeometry(wkbLineString); | |
for(int i = 0; i < ls->getNumPoints(); ++i) { | |
Point * pt = ls->getPointN(i); | |
lineString->addPoint(pt->getX(), pt->getY()); | |
} | |
return lineString; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CSVParser | |
{ | |
public: | |
CSVParser() {} | |
static int parseString(QString &buffer, QStringList &fields, QString delimChars, QString quoteChars, QString escapeChars) { | |
QString field; // String in which to accumulate next field | |
bool escaped = false; // Next char is escaped | |
bool quoted = false; // In quotes | |
QChar quoteChar = 0; // Actual quote character used to open quotes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ArrayList<Map<String, String>> readCSV(String filePath) throws IOException { | |
InputStream is = new FileInputStream(filePath); | |
ArrayList<Map<String, String>> al = new ArrayList<Map<String, String>>(); | |
BufferedReader br = new BufferedReader(new InputStreamReader(is)); | |
String[] headerLine = br.readLine().split(","); // reads the header of the file | |
String line = br.readLine(); // reads the first line of data | |
while (line != null) { | |
String[] values = line.split(","); | |
Map<String, String> map = new HashMap<String, String>(); | |
for (int i = 0; i < values.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtGui> | |
#include <QGraphicsRectItem> | |
#include <QGraphicsView> | |
#include <QApplication> | |
#include <QGraphicsSceneMouseEvent> | |
class CustomItem : public QGraphicsEllipseItem | |
{ | |
protected: | |
void mousePressEvent(QGraphicsSceneMouseEvent *event) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder