Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Tools/Graphview/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 1 kB image not shown  

Quelle  graph_file.scala   Sprache: Scala

 
/*  Title:      Tools/Graphview/graph_file.scala
    Author:     Makarius

File system operations for graph output.
*/


package isabelle.graphview


import isabelle._

import java.io.{File => JFile}
import java.awt.Graphics2D


object Graph_File {
  def write(file: JFile, graphview: Graphview): Unit = {
    val box = graphview.bounding_box()
    val w = box.width.ceil.toInt
    val h = box.height.ceil.toInt

    def paint(gfx: Graphics2D): Unit = {
      gfx.setColor(graphview.background_color)
      gfx.fillRect(0, 0, w, h)
      gfx.translate(- box.x, - box.y)
      graphview.paint(gfx)
    }

    val name = file.getName
    if (File.is_png(name)) Graphics_File.write_png(file, paint, w, h)
    else if (File.is_pdf(name)) Graphics_File.write_pdf(file, paint, w, h)
    else error("Bad type of file: " + quote(name) + " (.png or .pdf expected)")
  }

  def write(options: Options, file: JFile, graph: Graph_Display.Graph): Unit = {
    val graphview_options = options
    val graphview =
      new Graphview(graph.transitive_reduction_acyclic) {
        def options: Options = graphview_options
      }
    graphview.update_layout()
    write(file, graphview)
  }

  def make_pdf(options: Options, graph: Graph_Display.Graph): Bytes =
    Isabelle_System.with_tmp_file("graph", ext = "pdf") { graph_file =>
      write(options, graph_file.file, graph)
      Bytes.read(graph_file)
    }
}

100%


¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.