Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 7f965afc authored by Raphael Boucherie's avatar Raphael Boucherie Committed by BOUCHERIE Raphael
Browse files

added test file for drawing tree, anf functions to the library

parent ecbb5725
No related branches found
No related tags found
1 merge request!4Treewalk
...@@ -195,6 +195,16 @@ void libhqr_hqr_finalize( libhqr_tree_t *qrtree ); ...@@ -195,6 +195,16 @@ void libhqr_hqr_finalize( libhqr_tree_t *qrtree );
void libhqr_treewalk(const libhqr_tree_t *qrtree,int k); void libhqr_treewalk(const libhqr_tree_t *qrtree,int k);
/*
* function for treedraw
*/
void libhqr_writeheader();
void libhqr_writecss();
void libhqr_writeend();
void libhqr_drawTT(int x, int y, int k);
void libhqr_drawTS(int x, int y);
void libhqr_drawline(int x1, int y1, int x2, int y2);
/* /*
* Debugging functions * Debugging functions
*/ */
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
void libhqr_writeheader(){ void libhqr_writeheader(){
FILE *tree = fopen("../tree.xml", "w+"); FILE *tree = fopen("tree.svg", "w+");
if(fprintf(tree, "<?xml version=\"1.0\" standalone=\"no\"?>\n") < 0) return; if(fprintf(tree, "<?xml version=\"1.0\" standalone=\"no\"?>\n") < 0) return;
if(fprintf(tree, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n ") < 0) return; if(fprintf(tree, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n ") < 0) return;
if(fprintf(tree, "<svg width=\"2000\" height=\"2000\" version=\"1.1\" \n xmlns=\"http://www.w3.org/2000/svg\">") <0) return; if(fprintf(tree, "<svg width=\"2000\" height=\"2000\" version=\"1.1\" \n xmlns=\"http://www.w3.org/2000/svg\">") <0) return;
...@@ -41,11 +41,21 @@ void libhqr_writeheader(){ ...@@ -41,11 +41,21 @@ void libhqr_writeheader(){
void libhqr_writecss(); void libhqr_writecss();
void libhqr_drawTT(int x, int y, int k){ void libhqr_drawTT(int x, int y, int k){
FILE *tree = fopen("../tree.xml","w+"); FILE *tree = fopen("tree.svg","a+");
if(fprintf(tree,"<rect x=\"50\" y=\"50\" width=\"50\" height=\"50\" fill=\"red\" />") < 0 ) return; if(fprintf(tree,"<rect x=\"50\" y=\"50\" width=\"50\" height=\"50\" fill=\"red\" />") < 0 ) return;
} }
void libhqr_drawTS(int x, int y){
FILE *tree = fopen("tree.svg","a+");
if(fprintf(tree,"<rect x=\"40\" y=\"40\" width=\"50\" height=\"50\" />") < 0 ) return;
}
void libhqr_drawline(int x1, int y1, int x2, int y2){ void libhqr_drawline(int x1, int y1, int x2, int y2){
FILE *tree = fopen("../tree.xml","w+"); FILE *tree = fopen("tree.svg","a+");
if(fprintf(tree,"<line x1=\"20\" y1=\"80\" x2=\"130\" y2=\"200\" />") < 0 ) return; if(fprintf(tree,"<line x1=\"20\" y1=\"80\" x2=\"130\" y2=\"200\" />") < 0 ) return;
} }
void libhqr_writeend(){
FILE *tree = fopen("tree.svg", "a+");
if(fprintf(tree, "<\\svg>") < 0) return;
}
/**
*
* @file testting_treedraw.c
*
* PaStiX symbol structure routines
*
* @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
* @version 1.0.0
* @author Raphael Boucherie
* @author Matthieu Faverge
* @date 2017-04-04
*
**/
#include "libhqr.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(int argc, char ** argv)
{
libhqr_writeheader();
libhqr_drawTT(50,50,1);
libhqr_drawTS(40,40);
libhqr_drawline(50,50,40,40);
libhqr_writeend();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment