I try to change the font size for the associotion text in UMLGraph using the #opt edgefontsize but it seems that a default font size is used.
Note that the option #opt edgefontname works fine.
I'm on UMLGraph doclet version R5_7_2-32-g40b5a6
Here a demonstration - all fonts are increased to 22, but the association text remains small.
/**
* #hidden
* #opt postfixpackage
* #opt nodefontclassname "Arial Bold"
* #opt nodefontclassabstractname "Arial Italic"
* #opt nodefontclasssize 22
*
* #opt nodefontname "Arial"
* #opt nodefontabstractname "Times New Roman Italic"
* #opt nodefontsize 22
*
* #opt nodefonttagname "Courier New Italic"
* #opt nodefonttagsize 22
*
* #opt nodefontpackagename "Comic Sans MS"
* #opt nodefontpackagesize 22
*
* #opt edgefontname "Courier New Italic"
* #opt edgefontsize 22
* #opt types
*/
class UMLOptions{}
/**
* #opt attributes
* #assoc " " " " parent_id B
*/
class A {
public int id;
}
/**
* #opt attributes
*/
class B {
public int id;
}
Result
If you open the class Options (file Options.java) of the UMLGraph package you can see that the edgeFontSize is declared as
double edgeFontSize = 10;
Thus, it is set to a specific constant value. Plus, you can also see that the edgeFontName is declared as
String edgeFontName = Font.DEFAULT_FONT;
So edgeFondSize has a fixed value (which is 10) as a default font size and this is the reason why the size did not change when you set it to 22. On the other hand, edgeFontName is not fixed with a specific value and that's why it changes when you choose "Courier New Italic" or "Arial" etc.
In conclusion, one way to deal with the problem is that you define another value for edgeFontSize (e.g. 22) or to declare edgeFontSize in a similar way as edgeFontName. Its your call.
I really hope, that helps!
Related
Im trying to get the fixed cell width values with accuracy into two decimal points. But when the excel file is generated, the cell width is rounded into the whole number of the width size i want to achieve. Can this be done?
private Sheet setupSheet(XSSFWorkbook workbook) {
Sheet xssfSheet;
xssfSheet = workbook.createSheet("report");
xssfSheet.getPrintSetup().setLandscape(true);
xssfSheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
xssfSheet.setMargin(Sheet.HeaderMargin, 0.1);
xssfSheet.setMargin(Sheet.BottomMargin, 0.1);
xssfSheet.setMargin(Sheet.LeftMargin, 0.1);
xssfSheet.setMargin(Sheet.RightMargin, 0.1);
xssfSheet.setFitToPage(true);
PrintSetup ps = xssfSheet.getPrintSetup();
ps.setFitWidth((short) 1);
ps.setFitHeight((short) 0);
return xssfSheet;
}
Sheet sheet = setupSheet(workbook);
int widthExcel = 10;
int width256 = (int) Math.round((widthExcel * Units.EMU_PER_POINT + 5f) / Units.EMU_PER_POINT * 256f);
sheet.setColumnWidth(0, (int) (width256 * 1.14));
sheet.setColumnWidth(1, (int) (width256 * 0.49));
sheet.setColumnWidth(2, (int) (width256 * 0.85));
sheet.setColumnWidth(3, (int) (width256 * 1.45));
sheet.setColumnWidth(4, (int) (width256 * 0.46));
sheet.setColumnWidth(5, (int) (width256 * 2.85));
sheet.setColumnWidth(6, (int) (width256 * 2.02));
sheet.setColumnWidth(7, (int) (width256 * 0.66));
sheet.setColumnWidth(8, (int) (width256 * 0.72));
sheet.setColumnWidth(9, (int) (width256 * 0.86));
sheet.setColumnWidth(10, (int) (width256 * 0.75));
sheet.setColumnWidth(11, (int) (width256 * 0.90));
}
The question is not really clear. But if you want set the column width as Excel will show it in it's GUI, then this would must be done usig the formula given in Sheet.setColumnWidth.
Excel stores the column widths as integer values in unit 1/256th of a character width but shows them as how many characters fit into the cell as floating point number.
Example:
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.util.Units;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
class CreateExcelColumnWidth {
public static void main(String[] args) throws Exception {
try (Workbook workbook = new XSSFWorkbook();
FileOutputStream fileout = new FileOutputStream("./Excel.xlsx") ) {
Sheet excelSheet = workbook.createSheet();
float widthExcel = 10.71f;
int width256 = (int)Math.floor((widthExcel * Units.DEFAULT_CHARACTER_WIDTH + 5) / Units.DEFAULT_CHARACTER_WIDTH * 256);
excelSheet.setColumnWidth(0, width256);
workbook.write(fileout);
}
}
}
Result:
I have included the typings and referenced them.
I'm not sure if the typings are correct, since I don't know how to write them. But this is what I did:
// This is where I'm getting Cannot find name 'Polylabel'
geometry: polylabel(feat.geometry.coordinates)
I have included these typings:
declare module "polylabel" {
/**
* Polylabel returns the pole of inaccessibility coordinate in [x, y] format.
*
* #name polylabel
* #function
* #param {Array<number>} polygon - Given polygon coordinates in GeoJSON-like format
* #param {number} precision - Precision (1.0 by default)
* #param {boolean} debug - Debugging for Console
* #return {Array<number>}
* #example
* var p = polylabel(polygon, 1.0);
*/
function polylabel(polygon: number[][][], precision?: number, debug?: boolean): number[];
namespace polylabel {}
export = polylabel;}
And referenced it as follow:
/// <reference path="globals/#types/polylabel/index.d.ts" />
Instead of using /// <reference... add the .d.ts file to your tsconfig.json, on the "Files" section.
To use this module do this:
import * as polylabel from 'polylabel';
polylabel.polylabel(...)
or (If you are using namespaces and not imports)
polylabel.polylabel(...)
in java i have
color_value="FFAAFF";
I have tried:
int color = Integer.parseInt(color_value);`
How can I convert it to int(hex) to add to im_view.setBackgroundColor(int color);?
As we have to guess the lang you're using, i'll assume it's java, what you actually need is to convert from HEX to RGB, if you are comfortable with AWT then you could use a built in func:
String color_value = "FFAAFF";
im_view.setBackgroundColor(Color.decode(color_value));
If don't want to use AWT, then you could do it like this:
/**
*
* #param colorStr e.g. "#FFFFFF"
* #return
*/
public static Color hex2Rgb(String colorStr) {
return new Color(
Integer.valueOf( colorStr.substring( 1, 3 ), 16 ),
Integer.valueOf( colorStr.substring( 3, 5 ), 16 ),
Integer.valueOf( colorStr.substring( 5, 7 ), 16 ) );
}
im_view.setBackgroundColor(hex2Rgb(color_value));
I want to use Doxygen to document my c# code. So, I'm doing a trial run. So far it is not documenting the public functions in my test class. Here is my code:
/**
* #file doxyTest.cs
* #author Jon Plotner <plotnus#gmail.com>
* #version 1.0
*
* #section DESCRIPTION
* A test class for testing and running doxygen
*/
public class doxyTest{
/**
* Method1 adds the two numbers
* #param varA the first number to be added
* #param varB the second number to be added
* #returns An int which is the sum of varA and varB
*/
public int method1(int varA, int varB){
return a+b;
}
/**
* Method 2 compares the value of two numbers
* #param varA the first number
* #param varB the second number
* #return A bool, true if varA < varB
*/
public bool lessThan(int varA, int varB){
}
}
In the HTML output from Doxygen the "doxyTest Class Reference" is empty save for these lines:
The documentation for this class was generated from the following file:
*source/file1/doxyTest.cs
What am I doing wrong and how can I fix this?
The help is much appreciated as I've been trying to fix it myself for hours.
I've faced serious problem, which I couldn't solve for hours.
I have host activity with relativeLayout header and frameLayout below it for fragment.
[RelativeLayout]
[FrameLayout
].
I need to hide relative layout when keyboard appears, and show it when it hides with animation.
I solved that problem in that way:
ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
animator.setDuration(250);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
#Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
int offset = (int) (mHeaderLayout.getHeight());
float value = (Float) valueAnimator.getAnimatedValue();
LinearLayout.LayoutParams headerParams = (LinearLayout.LayoutParams) mHeaderLayout
.getLayoutParams();
LinearLayout.LayoutParams fragmentParams = (LinearLayout.LayoutParams) mFragmentLayout
.getLayoutParams();
headerParams.setMargins(0, (int) (-1 * value * offset), 0,
(int) (value * offset));
fragmentParams.setMargins(0, (int) (-1 * value * offset), 0,
(int) (value * offset));
mHeaderLayout.setLayoutParams(headerParams);
mFragmentLayout.setLayoutParams(fragmentParams);
}
});
animator.start();
But I've faced the problem, when keyboard appears, there is extra space which I need to fill,(height of RelativeLayout) due to moving layout.
Once your animation is done set the visibility of header to GONE and set the FrameLayout height to fill_parent. This will automagically make the FrameLayout to take the full space.