Skip to content

Instantly share code, notes, and snippets.

public void drawThing(File openedFile){
// Load xml file with the diagram to be drawn
Diagram diagram = loadXmlFile(openedFile);
// Update labels
statusLabel.setText("Loaded diagram. Generating image.");
errorLabel.setText("");
// Make an empty canvas to be passed around
Canvas drawing = new Canvas(800,500);
// Add to central pane
centralPane.getChildren().add(drawing);
/**
* Created by lucadorigo on 16/03/2017.
*/
@XmlRootElement(name = "relation")
public class Relation {
private String type, with;
// Keep track of which relation should be marked with dashed lines:
public static String[] dashed = new String[]{"realization", "dependency", "implementation"};
@XmlRootElement(name = "relation")
public class Relation {
private String type, with;
// Keep track of which relation should be marked with dashed lines:
public static String[] dashed = new String[]{"realization", "dependency", "implementation"};
// Hashmap with the different kinds of symbols:
public Canvas draw(Canvas canvas, double x, double y, double angle){
// First center to the drawing position and rotate to correct angle
canvas = translateAndRotate(canvas, x,y, angle);
// Draw the symbol horizontally
drawHorizontal(canvas);
// Revert to original position
canvas = unTranslateAndRotate(canvas,x,y,angle);
return canvas;
public DrawnDiagram(Diagram diagram, Canvas theCanvas){
this.theCanvas = theCanvas;
this.theDiagram = diagram;
ArrayList<DrawnBox> drawnBoxes = new ArrayList<>();
for (Box box: diagram.getBoxes()){
drawnBoxes.add(new DrawnBox(box,theCanvas));
}
this.drawnBoxes = drawnBoxes;
}
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import requestEvents from 'actions/feedActions';
import { FeedElement, feedElementTypes } from '../components/feed/feedElement';
class Feed extends React.Component {
componentWillMount() {
render() {
// console.log('Rendering feed');
// console.log('Feed State: ', this.props);
const listOfFeedElements = this.props.feedState.listOfFeedElements;
let elementsToDisplay;
if (this.props.feedState.receivedList === false) {
elementsToDisplay = <li key="0"> No elements to display</li>;
} else {
const numOfElementsToDisplay = listOfFeedElements.length <= 10 ?
listOfFeedElements.length : 10;
theCanvas.addEventHandler(MouseEvent.MOUSE_DRAGGED,
new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
// (Only do this if there is at least one box, or we get an error)
if (boxes != null) {
double x = e.getX();
double y = e.getY();
double offsetX = x - lastPressedX;
double offsetY = y - lastPressedY;
function brisagesRentables(coefficientActuel, revenuActuel, prixDeCraft, margeMinimum){
let benefTotal = 0;
let revenuTotal = 0;
let compteur = 0;
let coefficients = [];
const revenu100pourcent = revenuActuel/(coefficientActuel/100);
const revenuMinimum = prixDeCraft * ((100 +margeMinimum)/100);
const coefficientMinimum = 100*revenuMinimum/revenu100pourcent;
const src = `assets/images/testPrintView/${htmlElement.attributes[0]
.nodeValue}`;
return React.createElement('div', { className: 'o__print-view-image' }, [
React.createElement(
'img',
{
src: require(src),
alt: htmlElement.alt,
width: 400,
height: 300,