Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change spacing with double bond ? #242

Open
lpatiny opened this issue Dec 9, 2024 · 5 comments
Open

Change spacing with double bond ? #242

lpatiny opened this issue Dec 9, 2024 · 5 comments

Comments

@lpatiny
Copy link
Member

lpatiny commented Dec 9, 2024

I have the issue printing small labels with large molecules:

Image

The double bonds are not visible anymore.

I would like to be able to change the option cFactorBondSpacing but it seems to me to be private without any way to change it.

https://github.com/cheminfo/openchemlib/blob/17d264c81ccea9176ce576daedf959294eb93ff4/src/main/java/com/actelion/research/chem/AbstractDepictor.java#L148-L149

@targos Do you see a way we could customise this parameter that it not too hacky ?

@targos
Copy link
Member

targos commented Dec 9, 2024

Not really. I would ask Thomas for suggestions.

@thsa
Copy link

thsa commented Dec 9, 2024

To me it seems that we have a resolution issue here. The Depictor constants are optimized for publishing quality drawings, not to still recognize something when the resolution is reduced to the bare minimum. If you consider this really important, we can, of course, make the constant accessible...

@lpatiny
Copy link
Member Author

lpatiny commented Dec 10, 2024

Yes, it is clearly a resolution problem. We are printing on small labels using thermal transfer (Zebra printers, 300 dpi, resin ribbon), and we need to increase the bond width to keep the bonds readable and maintain high contrast. Giving the possibility to change the double bond distance would help in our case.

This is how to did the 'hack' to change the bondWidth:

if (options.strokeWidth) {
svg = svg.replace(/stroke-width="[^"]+"/g, 'stroke-width="' + options.strokeWidth + '"');
}

@thsa
Copy link

thsa commented Dec 10, 2024

would it be helpful to change the bondSpacing on a class level rather than for an Depictor instance?

As: public static void setBondSpacing(float bs) ?

@lpatiny
Copy link
Member Author

lpatiny commented Dec 11, 2024

A public static method on the Depictor instance seems perfect to me.

It is here that we would use it.

int mode = Util.getDisplayMode(options);
SVGDepictor d = new SVGDepictor(mol, mode, id);
d.setFactorTextSize(factorTextSize);
d.validateView(null, new GenericRectangle(0, 0, width, height),
AbstractDepictor.cModeInflateToMaxAVBL);
GenericRectangle b = d.getBoundingRect();
d.paint(null);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants