Sindbad~EG File Manager

Current Path : /home/beeson/ThreeBody/ThreeBodyProblem/
Upload File :
Current File : //home/beeson/ThreeBody/ThreeBodyProblem/send3Body.c

//
//  sendDocument3.c
//  for ThreeBody
//
/*   Created by Michael Beeson on 3/15/25
*/

#include <stdio.h>
#include <assert.h>
#include <math.h>  // fabs
#include <time.h>
#include "svgGraph3.h"
#include "uthash.h"
#include "ThreeBody.h"
#include "ThreeBodyDoc.h"
#include "sendJavascript.h"


  /*____________________________________________________________________*/
int sendDocument3(PDOCDATA3 pDocData)
/*  Write the HTML and SVG required to display the document to theDevice->next
If the amount of data exceeds outbuffersize, an assertion failure will
result,  so the allocated space had better  be sufficient.  This
function neither allocates nor destroys  outbuffer.
The response will just be echoed to the browser by PHP
It includes <svg> elements for the graph lines, with absolute
positioning.  (Therefore the client needs to place them inside a <div> with
relative or absolute positioning.)   When there are several graphs, the
Engine lays them out; the interface has only to display them.

The response does not include the user controls called (in Windows MathXpert)
the Graph Toolbar.  It does, however, include <svg> elements with class
toolbartext and ids as needed for the toolbars and class
toolbarhovertext  for pop-up explanatory text, and class
title,  with ids  title0, title1,...title6,  for the titles.
*/
{
    char id[32];
    rect r;
    r.left = pDocData->pxmin;   // pixel coordinates of the viewport
    r.right = pDocData->pxmax;
    r.top = pDocData->pymin;
    r.bottom = pDocData->pymax;
    sprintf(id,"graph0");
    int width2 = r.right-r.left;
    int height2 = r.bottom-r.top;
    // The <svg> must carry the viewport rectangle; it already has it
    // as a ClipRect, but JavaScript can't extract it via the DOM model, so we
    // tuck it into the <svg> declaration.
    begin_svg_withmyrect("graph",id,r.top,r.left,width2, height2);
    if(pDocData->border != pDocData->background)
       { // then outline the viewport.  We don't want it to scroll
         svg_rect(r.left, r.top, r.right,r.bottom, pDocData->border);
         r.left+=2;
         r.top+=2;
         r.bottom-=2;
         r.right-=2;
       }
    set_cliprect(r,0);
    char groupId[32];
    sprintf(groupId,"scrollable0");
     //  Next emit "<g id="scrollable0">
    begin_svgGroup("scrollable", groupId);
    drawAxes(pDocData);
    drawSolution(pDocData);
    end_svgGroup();
    end_svg();
    svgDevice *theDevice = get_device();
    sendJavaScript(theDevice->next,theDevice->bytesavailable,pDocData);
   int byteswritten = (int) strlen(theDevice->next);
   theDevice->next += byteswritten;
   theDevice->bytesavailable -= byteswritten;
   relinquish_device();
  return 0;
}

 

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists