How to programmatically apply MapXtreme Themes - gis

I maintain a Desktop application using MapXtreme 7.0 and I have
trouble finding much documentation or useful examples (I do have the
pdfs, samples etc that come on the install discs)
Currently I am trying to programmaticly apply an IndividualValueTheme
to a FeatureLayer. I can apply a standard default theme, I can also
show a ModifyIndValueThemeDlg and let the user change the theme.
However what I want to do is apply my own theme to the layer without
user intervention.
The following code attempts to do this but results in the Layer
showing with the default IndividualValueTheme (ie not with my styles)
Any help would be greatly appreciated
void ApplyTheme(FeatureLayer lyr)
{
if (lyr.Modifiers.Contains(HarvOpsTheme) || lyr.Modifiers.Contains(HarvOpsRangedTheme))
return;
HarvOpsTheme = new IndividualValueTheme(lyr, "iOperationType","HarvOpsTheme");
lyr.Modifiers.Append(HarvOpsTheme);
HarvOpsTheme.Bins[0].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(255, 255, 0)));
HarvOpsTheme.Bins[1].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(0, 255, 0)));
HarvOpsTheme.Bins[2].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(128, 128, 0)));
HarvOpsTheme.Bins[3].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(192, 128, 0)));
HarvOpsTheme.Bins[4].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(0, 128, 0)));
HarvOpsTheme.Bins[5].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(0, 205, 128)));
HarvOpsTheme.Bins[6].Style.ApplyStyle(GetHollowAreaStyle(Color.FromArgb(255, 0, 0)));
HarvOpsTheme.Apply(HarvOpsTheme);
HarvOpsTheme.RecomputeStyles();
lyr.Invalidate();
}
AreaStyle GetHollowAreaStyle(Color color)
{
return new AreaStyle
{
Interior = StockStyles.HollowFillStyle(),
Border = new SimpleLineStyle(new LineWidth(1,LineWidthUnit.Pixel), 1, color)
};
}

For Individual Theme only,recomputing styles causes to regenerate the first theming result.After user changes styles by [Bins] you do not need to recompute them again.
In short, simply remove the line and let the magic happen
HarvOpsTheme.RecomputeStyles();
Best Regards

Related

pdflib - is there's a way to rotate the page of pdf

before rotate
this is what i generate, with A4 Page.
before
after rotate
after generate, i wanna rotate the page like this.
please help me.
after
Totally possible!
Have a look at the PDFLib Cookbook (great resource for learning!), more specifically the sample for rotate_pages.
Basically you import a page into a document and place it with a new orientation. That will "rotate" the page as you like.
PHP sample code from the cookbook:
/* Loop over all pages of the input document */
for ($pageno = 1; $pageno <= $endpage; $pageno++)
{
$page = $p->open_pdi_page($indoc, $pageno, "");
if ($page == 0)
throw new Exception("Error: " . $p->get_errmsg());
/* Page size may be adjusted by fit_pdi_page() */
$p->begin_page_ext(0, 0, "width=a4.width height=a4.height");
/* Place the imported page on the output page. Adjust the page size
* automatically to the size of the imported page. Orientate the
* page to the west; similarly you can orientate it to the east or
* south, if required.
*/
$p->fit_pdi_page($page, 0, 0, "adjustpage orientate=west");
$p->close_pdi_page($page);
$p->end_page_ext("");
}

Add linear gradient over dynamic background-image in Angular 6

I have the following html code but it doesn't seem to work.
I'm trying to add a linear gradient over a dynamic background image url using Angular 6.
<header *ngIf="user?.backgroundPhotoUrl != null && user?.backgroundPhotoUrl !== ''"
[style.background-image]="'linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('+ user?.backgroundPhotoUrl +')'">
But it just comes back blank. Any help?
Take a look at the browser's console. Likely it will contain the following Angular warning:
WARNING: sanitizing unsafe style value linear-gradient(rgba(0, 0, 0, 0.3),.... (see http://g.co/ng/security#xss).
If this is the case, Angular will simply have removed your style rule because the Angular team decided that any custom style binding may potentially be harmful i.e. when the value would be derived from user input.
You will have to declare your bounded style rule as save, by wrapping that value like this:
<header [style]="headerStyle"> ...</header>
get headerStyle() {
return this.sanitizer.bypassSecurityTrustStyle(
' background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3)), url(' + this.backgroundPhotoUrl + '); '
);
}
this.sanitizer is an injected DomSanitizer.

How do I format a new line in a SASS (Syntactically Awesome Stylesheets) file? [duplicate]

I love Sass's indented syntax (as opposed to SCSS, which is whitespace agnostic and uses brackets and semicolons). I think it's much cleaner.
There's one issue I have with it. If I have a really long line, there's no way to split it into multiple lines (obeying the 80 character limit, for example)
Take this example of a really long mixin declaration, first written in SCSS.
#mixin col($cols, $mleft: 0, $mright: 0, $include-margin: false, $border: 0,
$pleft: 0, $pright: 0, $include-padding: true, $extra: 0,
$clear: false, $lead: true, $container: false) {
color: red;
display: block;
}
I'm able to split up one long declaration in to multiple lines. With the indented syntax, I don't think there's a way. I have to put the declaration on one line, which is way less readable.
#mixin col($cols, $mleft: 0, $mright: 0, $include-margin: false, $border: 0, $pleft: 0, $pright: 0, $include-padding: true, $extra: 0, $clear: false, $lead: true, $container: false)
color: red
display: block
Is there some way I don't know of? :(
Multiline is not supported by sass. Reading the doc, there is one exception, when it comes to multiple css selectors like in this example:
.users #userTab,
.posts #postTab
width: 100px
height: 30px
Read the doc here: http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#multiline_selectors
So, sadly: There is no possibility to get multi-line support for an argument list in sass.
First: do not create mixins with so many arguments. Divide it to many small mixins or insert some similar arguments as arrays (Sass have data maps for it).
Second: you can use temporary variables just for readability of your large code.
For example:
=mixin($argument)
body::before
content: $argument
$v1: 'foo-'
$v2: 'bar-'
$v3: 'baz.'
$var: $v1+$v2+$v3
+mixin($var)
This will get you mixin with all your $v# strings joined to one $var.
body::before {
content: 'foo-bar-baz';
}
If someone knows better way to join many strings into one in indented Sass syntax, I will be happy to know. Because I write complex gradients and inline generated SVG with this.

Show unread item count in Google Chrome extention icon

Is it possible to show unread item count in Google Chrome extension icon? If yes, then can someone point me to some pointers which explains how to do it?
I went through Google Chrome extension documentation, but couldn't figure it
If I understand correctly, you are looking for the browser-action's badge.
...a bit of text that is layered over the icon...
A badge has a background color and optionally some text and is used for displaying small bits of info (such as unread item count).
Use chrome.browserAction.setBadgeText to set/unset the text and chrome.browserAction.setBadgeBackgroundColor to set its color. E.g.:
var ba = chrome.browserAction;
function setAllRead() {
ba.setBadgeBackgroundColor({color: [0, 255, 0, 128]});
ba.setBadgeText({text: ' '}); // <-- set text to '' to remove the badge
}
function setUnread(unreadItemCount) {
ba.setBadgeBackgroundColor({color: [255, 0, 0, 128]});
ba.setBadgeText({text: '' + unreadItemCount});
}
Then use setUnread() and setAllRead() to show/hide the unread items count.

How do I create an inner drop shadow in text with php Imagick please?

I'm at the beginning of the learning curve with ImageMagick.
I have successfully created some text on a patterned background with outer light drop shadow to give the nice appearance of cut-out text.
To finish off the effect I need to give the text and inner dark drop shadow.
Are there any ImageMagick experts out there who can help with the php please?
This is my code so far which I'm happy with.
<?php
header('Content-type: image/jpeg');
$background_layer = new Imagick('test_background.jpg'); # background image
$d = $background_layer->getImageGeometry();
$w = $d['width'];
$h = $d['height'];
$text_layer = new Imagick();
$text_layer->newImage($w, $h, new ImagickPixel('none'));
$text_layer->setImageFormat('png');
$ImagickDraw = new ImagickDraw();
$ImagickDraw->setFillColor('#484848');
$ImagickDraw->setFont('Helvetica-Bold');
$ImagickDraw->setFontSize( 40 );
$ImagickDraw->setTextAlignment(2); // centre
$text_layer->annotateImage( $ImagickDraw, $w / 2, 50, 0, "Stuart's\niPhone" );
// create white drop shadow on it's own layer
$shadow_layer_white = $text_layer->clone();
$shadow_layer_white->setImageBackgroundColor( new ImagickPixel( 'white' ) );
$shadow_layer_white->shadowImage( 70, .3, 1, 1 );
// composite original text_layer onto shadow_layer
$shadow_layer_white->compositeImage( $text_layer, Imagick::COMPOSITE_OVER, 0, 0 );
// composite shadow_layer (which now has text AND the shadow) onto image_layer
$background_layer->compositeImage( $shadow_layer_white, Imagick::COMPOSITE_OVER, 0, 0 );
echo($background_layer);
?>
I'm too new to post images so you can see what I have so far at
http://www.avforums.com/images/temptest.php
Any help you can give to add an internal dark drop shadow in the text would be appreciated.
Thanks
You are using Imagick not Imagemagick directly and may want to add that tag as well.
I do not use Imagick but shadeimage should do what you want in one go?