/** getCellsBinary */ private void createCells() { ConstraintDefinition constraint = model.createConstraintDefinition(template); // int count = template.parameterCount(); ActivityDefinitonCell[] cells = new ActivityDefinitonCell[constraint.parameterCount()]; // ActivityDefinition [] params = new ActivityDefinition [count]; double total = 0; int c = 0; for (Parameter parameter : constraint.getParameters()) { ActivityDefinition activityDefinition = model.addActivityDefinition(); activityDefinition.setName(parameter.getName()); // params[i] = activityDefinition; constraint.addBranch(parameter, activityDefinition); ActivityDefinitonCell activityDefinitionCell = view.getActivityDefinitionCell(activityDefinition); total = activityDefinitionCell.getWidth() + 10; cells[c++] = activityDefinitionCell; } double radius = total / 2 + 100; Point[] points = Circle.getPoints(radius, cells.length); for (int i = 0; i < cells.length; i++) { ActivityDefinitonCell cell = cells[i]; int x = points[i].x + (new Double(cell.getWidth() / 2)).intValue(); int y = points[i].y + (new Double(cell.getHeight() / 2)).intValue(); cell.setPosition(new Point(x, y)); } model.addConstraintDefiniton(constraint); }
private static Properties buildProperties( final List<ConstraintDefinition> constraintDefinitions, final Properties inputProperties) { final PropertiesBuilder propertiesBuilder = new PropertiesBuilder(); for (final Property property : inputProperties.getProperties()) { propertiesBuilder.addValue(property, inputProperties.getValue(property)); } // On récupère les propriétés d'après les contraintes for (final ConstraintDefinition constraintDefinition : constraintDefinitions) { propertiesBuilder.addValue( constraintDefinition.getProperty(), constraintDefinition.getPropertyValue()); } return propertiesBuilder.build(); }